I would like to copy the string returned in FormatMessage() in the error array, but i only get garbage.
I dont know if the problem comes from the fact that FormatMessage() takes a tchar as a 5th parameter.
Code:char * reportError() { LPVOID Buf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &Buf, 0, NULL ); cout << (char*)Buf << "\n"; char error[260] =""; strcpy(error, (char*) Buf); LocalFree( Buf ); return error; }



LinkBack URL
About LinkBacks


