- Apr 15, 2005
- 367
- 0
- 0
Hi all,
I am very new to C++ but have been asked by work too figure this out, having tried for a few hours I am turning to you guys hopefully for some help.
I want to execute the appplication with a command line e.g. 'program.exe -FS' and this will change the options displayed in the program (this I have already coded). The code that I have so far is:
=============Code Start==============
#include <iostream>
using namespace std;
int main( int argc, // Number of strings in array argv
char *argv[], // Array of command-line argument strings
char *envp[] ) // Array of environment variable strings
{
int count;
for( count = 1; count < argc; count++ )
cout << "\nDefault Argument: " << argv[1];
if (argv[1] == "-FS") {
cout << "\nWorking" << argv[1];
}
}
=============Code End==============
All the code is working but the If Statement, your help and advice is very welcome
Thanks,
James
I am very new to C++ but have been asked by work too figure this out, having tried for a few hours I am turning to you guys hopefully for some help.
I want to execute the appplication with a command line e.g. 'program.exe -FS' and this will change the options displayed in the program (this I have already coded). The code that I have so far is:
=============Code Start==============
#include <iostream>
using namespace std;
int main( int argc, // Number of strings in array argv
char *argv[], // Array of command-line argument strings
char *envp[] ) // Array of environment variable strings
{
int count;
for( count = 1; count < argc; count++ )
cout << "\nDefault Argument: " << argv[1];
if (argv[1] == "-FS") {
cout << "\nWorking" << argv[1];
}
}
=============Code End==============
All the code is working but the If Statement, your help and advice is very welcome
Thanks,
James