#1
Code:
const char * const SrcFilePath;
const char * const SRecordPath;
const char * const FopIspFilePath;
I applaud your attempt at const correctness here but the second const in the above variable declarations means that the pointer itself is constant and cannot be changed outside of the point of declaration. Visual Studio 2010 won't even compile this, as written, it gives an error with following message:
Code:
1>test2.cpp(8): error C2734: 'SrcFilePath' : const object must be initialized if not extern
1>test2.cpp(9): error C2734: 'SRecordPath' : const object must be initialized if not extern
1>test2.cpp(10): error C2734: 'FopIspFilePath' : const object must be initialized if not extern
If you want to declare the variable here in main but assign something to them later on in the course of the program then you must at least remove the second const as follows:
Code:
const char * SrcFilePath;
const char * SRecordPath;
const char * FopIspFilePath;
#2
Code:
int i = 0;
for(i < argc; i++;)
What you probably meant here is"
Code:
int i = 0;
for(; i < argc; i++)
But, you can probably skip the first argument and start i at 1 instead of 0.
#3 On to your question, when you run the program from the command prompt you can simply add the arguments after the program name. If you are talking about running this for testing purposes within an IDE, then we'd have to know which IDE and could then provide instruction as to how the project would be configured to provide some values as if the program had been run from the command prompt with some form of default command line parameters.
Beyond handling the argv elements as you are doing there is nothing you need to do specifically to code to allow command-line parameters to be entered. That's handled at a scope outside your program.
Any question about if/else statements has nothing to do with allowing one to enter in arguments at the command line but rather what to do with the arguments (how to process the input) after they've already been entered.