Result = WriteStringN(#File, Text$ [, Format])
Write a string to a file and add an 'end of line' character.


#File The file to write to.
Text$ The string to write.
Format (optional) The format in which to write the string. It can be one of the following values:
  #PB_Ascii  : Writes the string in ASCII format
  #PB_UTF8   : Writes the string in UTF8 format
  #PB_Unicode: Writes the string in UTF16 format
If this parameter is not specified, the string will be written in UTF8 format if the program is compiled in unicode mode and in ASCII format otherwise.

Return value

Returns nonzero if the operation was successful and zero if it failed.


Because of file buffering, this function may return successful even if there is not enough space left on the output device for the write operation. The file must be opened using a write-capable function (i.e. not with ReadFile()).

To place a BOM (byte order mark) to later identify the string encoding format of a file use the WriteStringFormat() function. To write a string without a newline sequence, use the WriteString() function.

For an example see the CreateFile() function.

See Also

ReadString(), WriteString(), WriteStringFormat(), CreateFile(), OpenFile()

Supported OS


<- WriteStringFormat() - File Index - WriteUnicodeCharacter() ->