P
Protoman
Why does getenv work backwards? When I'm testing an env variable, I
have to test if its NOT equal to, rather than equal to, to get the
desired result. As evidenced by this simple piece of code:
#include <iostream>
#include <cstdlib>
using namespace std;
const char* cpu=getenv("PROCESSOR_ARCHITECTURE");
int main()
{
if(cpu!="x86")
cout << "Valid " << endl;
else
cout << "Invalid " << endl;
system("PAUSE");
return 0;
}
If I use if(cpu=="x86"), I get invalid, which is wrong, but if I use
if(cpu!="x86), I get valid, which is correct. It's like something is
backwards here, either with getenv() or WinXP itself. What's going on
here?
have to test if its NOT equal to, rather than equal to, to get the
desired result. As evidenced by this simple piece of code:
#include <iostream>
#include <cstdlib>
using namespace std;
const char* cpu=getenv("PROCESSOR_ARCHITECTURE");
int main()
{
if(cpu!="x86")
cout << "Valid " << endl;
else
cout << "Invalid " << endl;
system("PAUSE");
return 0;
}
If I use if(cpu=="x86"), I get invalid, which is wrong, but if I use
if(cpu!="x86), I get valid, which is correct. It's like something is
backwards here, either with getenv() or WinXP itself. What's going on
here?