Writes text or the specified binary variable to the file.
/fwrite [-bn] <name> <text | &binvar>
Explanation of the switches:
|b||indicates that a &binvar is being specified|
|n||appends a $crlf to the line being written.|
- The file handler must be opened before using /fwrite.
- When the file handler is first opened the pointer is at the end of the file so any /fwrite's upon opening the file handler will be appended to the file.
- When writing to the file handler you're never inserting data, you're overwriting data unless the data you're writing at the pointer exceeds the end of the file.
If you have a file containing this data below opened in a file handler called test:
A duck goes quack Dogs go woof Fish go moo Dana is silent but deadly
And you issue the command:
/fseek test -l 1 /fwrite -n test Ducks go quack
You will end up with a file containing:
Ducks go quack k Dogs go woof Fish go moo Dana is silent but deadly
The reason for this is /fwrite overwrites the same amount of data (unless exceeding the end of the file) from the file handler that you're writing (plus two if you issue -n for the $crlf)
/fwrite moo moo!
This will just add moo! to the end of the file assigned to the name moo.
/fwrite -n moo moo!
This will add moo! and a $crlf to the end of the file assigned to the name moo.
/fwrite -b moo &moo
This will add the content of the Binary Variable &moo to the end of the file assigned to the name moo.