[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
     NAME: FileSize

     USE:  Function to return the size of a file. FileSize will return
           the number of components of a file as related to the File
           variable.  If the file variable is of type byte, then
           FileSize will return the filesize of that file in bytes.
           Errors are returned through IOResult.  FileSize must be
           called on an open file and the file variable cannot be
           of type Text.

     DEPENDENCY:  None

     SYNTAX: FSize(FileVariable);

     RESULT: LongInt

     EXAMPLE:    Program TestFileSize;
                 Var
                    FVar     : File of Byte;
                    FSize    : LongInt;
                    FileName : String;

                 { No error checking }

                 Begin
                    Write('Enter File NAME: ');
                    Readln(FileName);
                    Assign(FVar,Filename);
                    Reset(FVar);
                    FSize := FileSize(FVar);
                    Writeln('The File Size of ',FileName,' is ',FSize);
                    Close(FVar);
                 end.

See Also: FilePos Seek
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson