Set the correct format and code page when calling the FileOpen function.
open_flags
[in] combination of flags determining the operation mode for the file. The flags are defined as follows:
FILE_READ file is opened for reading
FILE_WRITE file is opened for writing
FILE_BIN binary read-write mode (no conversion from a string and to a string)
FILE_CSV file of csv type (all recorded items are converted to the strings of unicode or ansi type, and are separated by a delimiter)
FILE_TXT a simple text file (the same as csv, but the delimiter is not taken into account)
FILE_ANSI lines of ANSI type (single-byte symbols)
FILE_UNICODE lines of UNICODE type (double-byte characters)
FILE_SHARE_READ shared reading from several programs
FILE_SHARE_WRITE shared writing from several programs
FILE_COMMON location of the file in a shared folder for all client terminals \Terminal\Common\Files
codepage=CP_ACP
[in] The value of the code page. For the most-used code pages provide appropriate constants.
Constant
Value
Description
CP_ACP
0
The current Windows ANSI code page.
CP_OEMCP
1
The current system OEM code page.
CP_MACCP
2
The current system Macintosh code page.
Note: This value is mostly used in earlier created program codes and is of no use now, since modern Macintosh computers use Unicode for encoding.
CP_THREAD_ACP
3
The Windows ANSI code page for the current thread.
CP_SYMBOL
42
Symbol code page
CP_UTF7
65000
UTF-7 code page.
CP_UTF8
65001
UTF-8 code page.
- www.mql5.com
thanks , but not work , i use all type of codepage , but return always chines char, i save my ini file with notepad with utf8 i suppose i must use 65001 but not work after this i test all but have always the same effect 0_o
int hFileHandle = FileOpen( sFileName, FILE_READ | FILE_TXT | FILE_ANSI, (short) NULL, CP_UTF8 );
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys i try to read a file ini , my file ini have this name correlazioni.ini and is located inside of .....\MQL5\Files , inside of correlazioni.ini i have this structure
[primario] symbl1=AUDUSD+ .... ... .. [correlato] symbl1=NZDUSD+ .... ... .. [soglia_minima] symbl1=0.4 .... ... ..i try to count the line and read in this mode
i suppose fileopen work in correct folder