int main( int argc, char** argv )
{
// If necessary, give the user instructions
if (argc < 3)
{
cout <<
"Convert a UTF-8 file to a wchar file.\n""usage:\n " << argv[ 0 ] << " UTF8-FILENAME WCHAR-FILENAME\n";
return 1;
}
Which looks fantastic and compiles (in context) but makes no sense to me and I think the parameters in main might have something to do with it? I am hoping to learn something that wil allow me to read more type sof code and to learn how it works. Thanks!
argc and argv are details of the input parameters.
Let's imagine your program is run by typing this:
someProgram firstParameter secondParameter
Then I would expect argc to be 3, argv[0] to be (a pointer to the char array containing) someProgram, argv[1] to be (a pointer to the char array containing) firstParameter and argv[2] to be (a pointer to the char array containing) secondParameter.
You will probably hear them referred to as "command-line arguments", which simply means additional arguments given when starting the program through the command line.