home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
suite.zip
/
pct.zip
/
fileinfo.ext
< prev
next >
Wrap
Text File
|
1999-12-20
|
2KB
|
69 lines
@File Info
%Charin file to a variable
$/* Charin file to a variable */
numchars = CHARS(filename)
value = CHARIN(filename,1,numchars)
rc=STREAM(filename,'c','close')
%Close file
$/* Close file */
CALL STREAM filename, 'C', 'CLOSE'
%Does file exist?
$/* Does file exist? */
value = (STREAM(filename, 'C', 'QUERY EXISTS') <> '')
%Get file date & time stamp
$/* Get file date & time stamp */
Parse Value STREAM(filename, 'C', 'QUERY DATETIME') With fdate ftime
Parse Var fdate mm '-' dd '-' 'yy'
Parse Var ftime hh ':' mm ':' ss
%Get file size in bytes
$/* Get file size in bytes */
value = STREAM(filename, 'C', 'QUERY SIZE')
%Get file status
$/* Get file status */
value = STREAM(filename, 'S')
%Get file status with error code
$/* Get file status with error code */
value = STREAM(filename, 'D')
%More characters in the file?
$/* More characters in the file? */
value = CHARS(file)
%More lines in the file?
$/* More lines in the file? */
value = LINES(file)
%Open file for reading
$/* Open file for reading */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN READ')
%Open file for reading & writing
$/* Open file for reading & writing */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN')
%Open file for writing
$/* Open file for writing */
/* rc will hold 'READY' if successful */
rc = STREAM(filename, 'C', 'OPEN WRITE')
%Read a character from the file
$/* Read a character from the file */
value = CHARIN(filename)
%Read a line from the file
$/* Read a line from the file */
value = LINEIN(filename)
%Set read/write position in file backward from current position
$/* Set read/write position in file backward from current position */
Call STREAM filename, 'C', 'SEEK -'value
%Set read/write position in file forward from current position
$/* Set read/write position in file forward from current position */
Call STREAM filename, 'C', 'SEEK +'value
%Set read/write position in file from end of file
$/* Set read/write position in file from end of file */
Call STREAM filename, 'C', 'SEEK <'value
%Set read/write position in file from start of file
$/* Set read/write position in file from start of file */
Call STREAM filename, 'C', 'SEEK ='value
%Write a line to the file
$/* Write a line to the file */
CALL LINEOUT filename, value
%Write a string of characters to the file
$/* Write a string of characters to the file */
CALL CHAROUT filename, value