GetPrivateProfileString() problem
-
What is woring in my following codes run time error is occuring for both code int main() {LPTSTR strResult; LPTSTR strDefault=L"no"; DWORD d=255; GetPrivateProfileString(L"data",L"Patchcab ", strDefault,strResult,d, L"D:\\TMP\\patchpolicy.ini"); printf("%s",strResult); } int main() { LPTSTR strResult=L""; LPTSTR strDefault=L"no"; DWORD d=255; GetPrivateProfileString(L"data",L"Patchcab ",strDefault,strResult ,d,L"D:\\TMP\\patchpolicy.ini"); printf("%s",strResult); }
-
What is woring in my following codes run time error is occuring for both code int main() {LPTSTR strResult; LPTSTR strDefault=L"no"; DWORD d=255; GetPrivateProfileString(L"data",L"Patchcab ", strDefault,strResult,d, L"D:\\TMP\\patchpolicy.ini"); printf("%s",strResult); } int main() { LPTSTR strResult=L""; LPTSTR strDefault=L"no"; DWORD d=255; GetPrivateProfileString(L"data",L"Patchcab ",strDefault,strResult ,d,L"D:\\TMP\\patchpolicy.ini"); printf("%s",strResult); }
There is no memory allocated for the
LpReturnedString
parameter. You're declaring it asLPTSTR strResult
which is only a pointer. You will need to do this -TCHAR strResult[255];
DWORD d = 255;Also change
printf
to_tprintf
.«_Superman_» I love work. It gives me something to do between weekends.
-
There is no memory allocated for the
LpReturnedString
parameter. You're declaring it asLPTSTR strResult
which is only a pointer. You will need to do this -TCHAR strResult[255];
DWORD d = 255;Also change
printf
to_tprintf
.«_Superman_» I love work. It gives me something to do between weekends.
thanks a lot.