/* */ call rxfuncadd 'Sys2LoadFuncs', 'RXUTILEX', 'Sys2LoadFuncs' call Sys2LoadFuncs SAY 'Testing file creation/replacement...' fh = Sys2Open("test1", "rc") if fh == '' then say SYS2ERR else do ok = Sys2Write( fh, "The quick brown fox jumps over the lazy dog.") if ok == 0 then say SYS2ERR else say ok 'bytes written' ok = Sys2Close( fh ) IF ok == 0 then say SYS2ERR else say 'File closed successfully.' end SAY SAY 'Testing file read/seek...' fh = Sys2Open("test2", "o") if fh == '' then say SYS2ERR else do off = Sys2Seek(fh, 0, 'E') if off == '' then say SYS2ERR else say 'File size is:' off 'bytes' off = Sys2Seek( fh, 86, 'B') if off == '' then say SYS2ERR data = Sys2Read( fh, 37 ) if data == '' then say SYS2ERR else say '37 bytes from offset 86:' data remain = Sys2BytesRemaining( fh ); say remain 'bytes left in file.' ok = Sys2Close( fh ) IF ok == 0 then say SYS2ERR else say 'File closed successfully.' end call Sys2DropFuncs return 0