FileWriteln

Prev Next Home Home Table Of Contents Index

FileWriteln (FileVar,String)

Writes text to a file with a carriage return and a line feed. FileWriteln can also be used in place of the FileLog command which is now obsolete.


Example:
FileAssign(F,'NUMBERS.TXT) FileCreate(F) FileWriteln 'Counting to 100' Loop 100 FileWriteln Str(LoopIndex) EndLoop FileClose(F)

Example:
FileWriteln ('INSTALL.LOG','Add This Line')

The fastest way to write data to a file and have it remain open is to use FileAssign to set up a file variable and then use FileCreate or FileAppend to open the file and use FileWriteln with a file variable to write data to the file and FileClose to finish.

However, if you want to create a one line file or append only one line to a file you can use FileWriteln by passing a file name instead of a file variable. If you pass only a file name then MarxMenu will either open the file or create the file if it doesn't exist. Then it will add the line to the end of the file and close the file.

The second method is faster if you just want to add one line to a file. However, if you are writing a lot of lines it's slower because it opens and closes the file between each line and doesn't maintain any file locks between lines.

See Also: FileOpen FileWrite FileResult FileLog FileCreate
FileAppend FileClose FileAssign

Category: File

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home