Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

fileopen

May
57
0
4NT V8

fileopen[file,w,b]

"w"rite appears to make no difference if file exists but seems to behave as tho
"a"ppend is in affect
I would expect the file empty with "w"rite parameter

example from help file altered to show above.

do r=14 to 8 by -1
set h=%@fileopen[myfile.txt,write,b]
echo writing %@filewriteb[%h,%r,this is a test] bytes
echo closing handle #%h: %@fileclose[%h]
enddo
 
Rex Clark wrote:
| 4NT V8
|
| fileopen[file,w,b]
|
| "w"rite appears to make no difference if file exists but seems to
| behave as tho "a"ppend is in affect
| I would expect the file empty with "w"rite parameter

The @fileopen[] function does not behave the same way as the standard C
library function fopen() for files that already exist. It simply opens the
file for overwriting. Since 4NT/TCMD version 6 the @TRUNCATE function has
been made available to shorten the file.
--
HTH, Steve
 
Back
Top