GetPrivateProfileStringW in MQL4 bytes read is just 1.
#import "kernel32.dll" bool WritePrivateProfileStringW(string lpSectionName, string lpKeyName, string lpString, string lpFileName); int GetPrivateProfileStringW(string lpApplicationName, string lpKeyName, string lpDefault, string lpReturnedString, int nSize, string lpFileName); #import
i would prefer to use
int GetPrivateProfileSectionW(string lpAppName, string lpReturnedString, int nSize, string lpFileName);
or maybe
int GetPrivateProfileSectionW(string lpAppName, char& lpReturnedString[], int nSize, string lpFileName);
because you have to deal with a terminator
for(int x = 0; x <= ArraySize(buffer); x++) { if (buffer[x] == 0) { buffer[x] = '\n'; } } for(int y = 0; y <= ArraySize(buffer); y++) { if (buffer[y] == '\n' && buffer[y+1] != '\n') { for(int z = y; z <= ArraySize(buffer) - y; z++) { buffer[z] = buffer[z+1]; } } } string str_res = CharArrayToString(buffer); Print("Output=",str_res, ", Bytes Read=",read);
The above code is producing undesirable output:
Output=3, Bytes Read=1
the declaration is as follows:
How do i use this function properly GetPrivateProfileStringW anyone to help?