Writes a specified string to a file.
FPUTS("string", "filename", escapes)
"string" |
- |
A string, the text to write. |
||||
"filename" |
- |
A string, the target file name. |
||||
escapes |
- |
Optional. An integer, the escape character flag to convert "\" escape characters:
|
A 1 if the write is successful; otherwise it returns nothing.
fopen("myheader.hdr", "w+");
fputs("DATASET Pressure\n", "myheader.hdr");
fputs("SERIES Pressure_1, Pressure_2\n", "myheader.hdr");
fclose("myheader.hdr");
creates a file called myheader.hdr that contains the following information:
DATASET Pressure
SERIES Pressure_1, Pressure_2
If the file myheader.hdr already existed, its former contents would be lost and replaced by the information shown above.
Must be used with FOPEN and FCLOSE. The last string written to the file must end with '\n'.
If escapes is 1 (the default), the escape sequences listed below are automatically converted. Escape sequences are designed to output non-printing characters.
\n |
newline |
\t |
tab |
\b |
backspace |
\r |
carriage return |
\f |
form feed |
\\ |
backslash |
\' |
single quote |
\ddd |
bit pattern |
ddd d is an octal digit ASCII character with corresponding octal ASCII code.
A backslash followed by any other character simply writes the character.
See FPRINTF to perform formatted string output to a file.