Jump to content

Recommended Posts

Posted (edited)

From the help file:

FileOpen ("filename" [,mode])

Opens a text file for reading or writing.

Parameters

filename Filename of the text file to open.

mode [optional] Mode to open the file in.

Can be a combination of the following:

0 = Read mode (default)

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

8 = Create directory structure if it doesn't exist (See Remarks).

16 = Force binary mode (See Remarks).

32 = Use Unicode UTF16 Little Endian reading and writing mode. Reading does not override existing BOM.

64 = Use Unicode UTF16 Big Endian reading and writing mode. Reading does not override existing BOM.

128 = Use Unicode UTF8 (with BOM) reading and writing mode. Reading does not override existing BOM.

256 = Use Unicode UTF8 (without BOM) reading and writing mode.

16384 = When opening for reading and no BOM is present, use full file UTF8 detection. If this is not

used then only the initial part of the file is checked for UTF8.

The folder path must already exist (except using mode '8' - See Remarks).

What you want is mode 2

FileOpen("Readme.txt", 2)  ;erase preivious contents
Edited by Varian
Posted

Well surely Varian opinion is more professional than mine, but, i think also FileRead would be fine.

You can read the file with it, copy where you need it, then delete the content of the previous with filedelete.

FileReadLine allow a selective reading.

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Posted

Well surely Varian opinion is more professional than mine, but, i think also FileRead would be fine.

You can read the file with it, copy where you need it, then delete the content of the previous with filedelete.

FileReadLine allow a selective reading.

You answered with the OP's other option, so your point is just as valid. I would suggest the FileOpen() mode 2 depending on the way in which the OP chooses/needs to create the "replacement" file. It may be that he/she would still utilize FileOpen() to create this file, or maybe _FileCreate() because unless your function or command creates the file intrinsically, he/she would still need to create the file again in order to write to it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...