keeps outputting "error"PHP Code:#include <iostream.h>
#include <windows.h>
//using namespace std;
int main()
{
UINT i;
char path[MAX_PATH];
UINT sz = MAX_PATH;
i = GetWindowsDirectory(path, sz);
if (i==ERROR_SUCCESS) {
cout << path << endl;
// you got it --- path is a null terminated string
}
else {
cout << "error" << endl;
//something bombed.... not very likely with this call
//call GetLastError to see what happened
}
return 0;
}
If I say if(i != ERROR_SUCCESS), I get the correct path.
![]()




Reply With Quote