Link to home
Start Free TrialLog in
Avatar of Brian Dumas
Brian DumasFlag for United States of America

asked on

using GetPrivateProfileSectionNames for UNICODE

Using VS2008.
My code is attached. It always returns slength==0. And no strings in the szResult. Can anyone show me how to get this working ina UNICODE environment?

char* szResult = new char[2000];
memset(szResult, 0x00, 2000);
int slength=GetPrivateProfileSectionNames((LPWSTR)szResult, 2000, (LPWSTR)m_szFileName);

Open in new window

Avatar of Brian Dumas
Brian Dumas
Flag of United States of America image

ASKER

Also, please show how to parse the szResult to get each section name from it. I am storing the section names in a vector of std::string type.

Thanks, Brian
What does GetLastError function returns? call this function just after GetPrivateProfileSectionNames call and let us know the error code
GetLastError returns "The operation completed successfully."
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
http://www.codeproject.com/KB/cpp/UNICOD_inifile.aspx
Check this. This page has the class with appropriate members to read the data. If it works we can do the parsing in the next step.
Thanks for the quick and accurate help