====== fwrite ======
===== Description =====
Write an object to a file.
===== Function prototype =====
bool fwrite
===== Arguments =====
^ Name ^ Type ^ Comment ^
| //hFile// | voidptr | A handle to a file created by [[plugins:general:zeoscript:reference:functions:fopen]] or [[plugins:general:zeoscript:reference:functions:fopen_s]]. |
| //Data// | varref | A reference to an initialised variable, the value of which is to be written to the file. The type of the variable determines the number of bytes to be written. |
===== Return value =====
True if success, false otherwise.
===== Example =====
//
// ask user for filename
//
string FileName
set FileName
if >
return 0
endif
//
// Ask user for text to write to file
//
string s
if >
return 0
endif
//
// Open file
//
voidptr fp
assert "Cannot open file!"
//
// Write text to file using fwrite
//
fwrite fp s
//
// Close file
//
fclose fp
===== Comments =====
None.
===== See also =====
* [[plugins:general:zeoscript:reference:functions:fopen]]
* [[plugins:general:zeoscript:reference:functions:fopen_s]]
* [[plugins:general:zeoscript:reference:functions:fclose]]
* [[plugins:general:zeoscript:reference:functions:fread]]
* [[plugins:general:zeoscript:reference:functions:fgetc]]
* [[plugins:general:zeoscript:reference:functions:fputc]]
* [[plugins:general:zeoscript:reference:functions:fseek]]
* [[plugins:general:zeoscript:reference:functions:ftell]]
* [[plugins:general:zeoscript:reference:functions:rewind]]