I was wondering, is there ANY safe place to use system("")?
I am wanting to detect the OS version in a Windows system, and here's the code I'm using:
1 2 3 4 5 6 7 8
#include <iostream>
int main() {
std::cout<<"Your PC is running under ";
system("echo %OS%.");
std::cin.get();
return 0;
}
It's only going to be used on Windows.
There's also 1 more:
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
usingnamespace std;
int main() {
cout<<"Press enter to see your PC info."<<endl;
cin.get();
cout<<endl;
system("set");
cin.get();
return 0;
}
I'm also using it w/ Windows, just to show the PC info.