Device 3 Example

Top  Previous  Next

\Read an input file

 

Hand:= FOpen("C:\DIR\FILENAME.EXT", 0); \Get handle for in file

FSet(Hand, ^I);                         \Set device 3 to handle

OpenI(3);                               \Initialize input buffer

repeat until ChIn(3) = $1A;             \Read some characters

FClose(Hand);                           \Close out this handle

 

 

\Write an output file

 

Hand:= FOpen("C:\DIR\FILENAME.EXT", 1); \Get handle for out file

FSet(Hand, ^o);                         \Set device 3 to handle

OpenO(3);                               \Initialize output buffer

for Ch:= $20, $7E do ChOut(3, Ch);      \Write some characters

ChOut(3, $1A);                          \Write end-of-file Ctrl-Z

Close(3);                               \Flush output buffer

FClose(Hand);                           \Close out this handle