Documentation
MQL5 ReferenceFile FunctionsFileWriteStruct 

FileWriteStruct

The function writes into a bin-file contents of a structure passed as a parameter, starting from the current position of the file pointer.

uint  FileWriteStruct(
   int                file_handle      // File handle
   any_simple_struct  str_object&,     // link to an object
   int                size=-1          // size to be written in bytes
   );

Parameters

file_handle

[in]  File descriptor returned by FileOpen().

str_object&

[in] Reference to the object of this structure. The structure should not contain strings, dynamic arrays or virtual functions.

size=-1

[in] Number of bytes that you want to record. If size is not specified or the specified number of bytes is greater than the size of the structure, the entire structure is written.

Return Value

If successful the function returns the number of bytes written. The file pointer is shifted by the same number of bytes.

See also

Structures and classes