MQL4 Reference
File functions
FileWriteString
| int FileWriteString( |
int handle, string value, int length) |
The function writes the string to a binary file from the current file position.
Returns the actually written bytes count or a negative value if an error occurs.
To get the detailed error information, one has to call the GetLastError() function.
Parameters:
| handle |
- |
File handle returned by the FileOpen() function. |
| value |
- |
String to be written. |
| length |
- |
The length of the string to be written. If the string length exceeds the given value, it will be truncated. If it is shorter, it will be extended by binary 0s up to the given length. |
Sample:
int handle;
string str="some string";
handle=FileOpen("filename.bin", FILE_BIN|FILE_WRITE);
if(handle<1)
{
Print("can't open file error-",GetLastError());
return(0);
}
FileWriteString(handle, str, 8);
FileClose(handle);
|
|
|