Getting Other Information about a File

The QUERY method can do more than check for the existence of a file. It can return date and time stamps, read position, write position, the size of the file, and so on. The following example shows most of the QUERY arguments.

/* INFOON.CMD -- display information about a file */
parse arg fid
qfile=.stream~new(fid)
fullpath=qfile~query('exists')
if fullpath='' then do
   say fid 'does not exist.'
   exit
end
qfile~open('both')
say ''
say 'Full path name:' fullpath
say 'Date and time stamps (U.S. format):' qfile~query('datetime')
say '            (International format):' qfile~query('timestamp')
say ''
say 'Handle associated with stream:' qfile~query('handle')
say '                  Stream type:' qfile~query('streamtype')
say ''
say '          Size of the file (characters):' qfile~query('size')
say ' Read position (in terms of characters):' qfile~query('seek
read')
say 'Write position (in terms of characters):' qfile~query('seek
write') qfile~close


[Back: Does the File Exist?]
[Next: Using Standard I/O]