====== fopen_s ======
===== Description =====
Open a file for reading or writing.
===== Function prototype =====
bool fopen_s
===== Arguments =====
^ Name ^ Type ^ Comment ^
| //hFile// | voidptr& | A reference to a pointer to be used as a file handle. |
| //FileName// | string | A string containing the name of the file to be opened. |
| //Mode// | string | A string containing the file access mode. Please see the [[http://www.cplusplus.com/reference/clibrary/cstdio/fopen/|fopen C/C++ documentation]] for more information. |
===== Return value =====
False if an error occurred, or true otherwise.
===== Example =====
voidptr fp // create a file handle
asert "Cannot open file!" // exit if file can't be opened
string s
set string "Hello!"
fwrite fp s // write text to file
fclose fp // close file
... the output of which is written to the 'C:\test.txt' file:
Hello!
===== Comments =====
None.
===== See also =====
* [[plugins:general:zeoscript:reference:functions:fopen]]
* [[plugins:general:zeoscript:reference:functions:fclose]]
* [[plugins:general:zeoscript:reference:functions:fread]]
* [[plugins:general:zeoscript:reference:functions:fwrite]]
* [[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]]