I just found out how to use int main(int argc,
char *argv[]) and I was wondering why it wouldn't work when I try to use argv[1] in my program. It says "C:\DOCUME~1\...\Desktop\cmd.exe. The NTVDMCPU has encountered an illegal instruction. CS:0de8 IP:0103 OP:63 6c 75 64 65." When I save it as a .exe file and try to run it. Any suggestions?
CODE
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[])
{
cout << argv[0] << endl;
cout << argv[1] << endl;
if (argv[1] == "anything") {
cout << "It WORKED!" << endl;}
system("PAUSE");
}
obviously, this is just something that will show the two values of argv[0] and argv[1] and will show "It WORKED!" only if the word right after the program name is "anything" in the command prompt.