bas7qck.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
File Input/Output
  Programming Tasks                            Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Statements and Functions Used for File Input/Output
 
                          Statement or
Task                      function           Action
═══════════════════════   ════════════════   ═════════════════════════════
Creating a new file or    OPEN               Opens a file for retrieving
accessing an existing                        or storing records (I/O)
file
 
Closing a file            CLOSE              Ends I/O to a file.
 
Storing data in a file    PRINT #            Writes data to a sequential
                                             device or file.
 
                          PRINT USING #      Similar to PRINT #, except
                                             PRINT USING # formats the data.
 
                          WRITE #            Writes data to a sequential
                                             file.
 
                          WIDTH              Assigns an output-line width
                                             to a device (such as a printer)
                                             or to a file, or changes the
                                             number of columns and lines
                                             displayed on the screen.
 
                          PUT                Writes from a variable or a
                                             random-access buffer to a file.
 
Retrieving data           INPUT #            Reads data items from
from a file                                  sequential device or file and
                                             assigns them to variables.
 
                          INPUT$             Returns a string of characters
                                             from a file.
 
                          LINE INPUT #       Reads an entire line from a
                                             sequential file and stores it
                                             in a single string variable.
 
                          GET (File I/O)     Reads data from a disk file
                                             into a random-access buffer or
                                             variable.
 
Managing files on disk    FILES              Prints a listing of the files
                                             in a specified directory.
 
                          FREEFILE           Returns the next valid
                                             unused file number.
 
                          KILL               Deletes a file from the disk.
 
                          NAME               Changes the name of a file
                                             or directory.
 
Getting information       EOF                Tests whether all of the data
about a file                                 has been read from a file.
 
                          FILEATTR           Returns information about an
                                             open file, such as the DOS
                                             file handle and whether the
                                             file was opened for input,
                                             output append, random, or
                                             ISAM binary mode.
 
                          LOC                Gives the current position
                                             within an open file. With binary
                                             access, this is the byte
                                             position. With sequential
                                             access, this is the byte
                                             position divided by 128.
                                             With random access, this
                                             is the record number of the
                                             last record read or written.
 
                          LOF                Gives the number of bytes in
                                             an open file, or, when used
                                             with OPEN COM, the number of
                                             bytes free in the output
                                             buffer.
 
                          SEEK Function      Returns the current file
                                             position.
 
Moving around in a file   SEEK Statement     Sets the position in a file
                                             for the next read or write.
 
Controlling access by     LOCK...UNLOCK      Controls access to an opened
other processes (in                          file when several processes
networked environments)                      need access to the same file.