Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> assign set file variable to a file name pp 94</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ASSIGN               Set File Variable to a File Name                 pp 94

 Syntax:  Assign (FileVar,String) ;

 Type:    File

 Form:    Procedure

 Purpose: FileVar becomes an identifier or file handle to access a file.
          The text, String, is the Drive:\Path\Filename.Ext assigned to
          FileVar.


 ----------------------------------------------------------------------------


 Usage:
       TYPE
          FileType = String [80]             ;   { Define record size  }
       VAR
          FileVar  : File of FileType        ;   { 80 byte record type }
          TxtFile  : Text                    ;   { Declare text file   }
       CONST
          FileName : String [8] = 'Name.Ext' ;   { Constant file name  }

       BEGIN
          Assign (FileVar,FileName)          ;   { Assign file name    }
          Assign (TxtFile,FileName)          ;   { Assign file name    }
          Append (FileVar)                   ;   { Open for append     }
          Reset  (TxtFile)                   ;   { Open for read       }
       END.

See Also: Append File Of Files Reset ReWrite

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson