-
October 9th, 2013, 12:14 PM
#1
ussing if or Switch with LPCWSTR
Hello,
i am trying to read an ini file and usse an if or switch to take action.
i have this in ini.h file
LPCWSTR ini_read_string(LPCWSTR _ini_File_Name, LPCWSTR _ini_Section_Name, LPCWSTR _ini_Key_Name, LPCWSTR _ini_Default )
{
TCHAR _Rvalue[5];
GetPrivateProfileStringW(_ini_Section_Name,_ini_Key_Name,_ini_Default,_Rvalue,5,_ini_File_Name);
return (LPCWSTR) _Rvalue;
}
now when i do this:
OverLay[0]=ini_read_string(map_file_ini,_T("Section"),_T("Key"),_T("NULL"));
if(OverLay[0]==_T("NULL"))MessageBox(NULL,_T("File or kay not exists"),_T("Error"),MB_ICONEXCLAMATION|MB_OK);
but the key dos not exists, so it will return NULL, but yet i am not getting the message box (LPCWSTR)
i also dit try
if(OverLay[0]=="NULL"), if(OverLay[0]==L"NULL"),if(OverLay[0]== (LPCWSTR)"NULL"), if(OverLay[0]== (LPCWSTR)L"NULL"), if(OverLay[0]== (LPCWSTR)_T("NULL"))
but it never dit work.
to be sure of the returning value i also dit this
MessageBox(NULL,ini_read_string(map_file_ini,_T("Section"),_T("kay"),_T("NULL")),(LPCWSTR)L"Error!",MB_ICONEXCLAMATION|MB_OK);
and ther it is, an message box with the text "NULL"
so why is the if(OverLay[0]==xxx) not working?
and i also need a big list so an working switch(OverLay[0]) will be nice as well (else i need to do if/ else if many times)
Thanks for reading
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|