|
FileOpenThe function opens the file with the specified name and flag.
Parameters file_name [in] The name of the file can contain subfolders. If the file is opened for writing, these subfolders will be created if there are no such ones. open_flags [in] combination of flags determining the operation mode for the file. The flags are defined as follows: delimiter=';' [in] value to be used as a separator in txt or csv-file. If the csv-file delimiter is not specified, the default delimiter is ";". If the txt-file delimiter is not specified, then no separator is used. If the separator is clearly set to 0, then no separator is used. codepage=CP_ACP [in] Optional parameter. The value of the code page. For the most-used code pages provide appropriate constants. Return Value If a file has been opened successfully, the function returns the file handle, which is then used to access the file data. In case of failure returns INVALID_HANDLE. Note For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means, cannot be outside the file sandbox. The file is opened in the folder of the client terminal in the subfolder MQL4\files (or Tester\Files in case of testing). If FILE_COMMON is specified among flags, the file is opened in a shared folder for all MetaTrader 4 client terminals. "Named pipes" can be opened according to the following rules:
A special symbol '\' is used in shown strings. Therefore, '\' should be doubled when writing a name in MQL4 application. It means that the above example should have the following look in the code: "\\\\servername\\pipe\\pipename". More information about working with named pipes can be found in the article "Communicating With MetaTrader 5 Using Named Pipes Without Using DLLs". Example:
See also Use of a Codepage, FileFindFirst(), FolderCreate(), File opening flags |