Hey everyone. I'm a student at NIU and am looking for a little help to start me off on my first assignment. I just recently changed to a comp sci major, and am new to C++, but I have taken a course in C a few years back under my old major. Anyway, here's my question:
For my assignments, I'm supposed to read in 2 filenames from a command line. My teacher gave me the syntax for the main() function as:
int main(int argc, char *argv)
I understand that argc is the number of arguments. The command line I will be entering is:
programname lines.dat township.dat
First, will argc = 2 or will argc = 3, and therefore will the
char *argv look like this:
argv = programname or this argv = lines.dat
argv = lines.dat argv = township.dat
argv = township.dat
Also, when I enter the above command line, does argc automatically get set to 2 or 3, and does argv get set to one of the two assignments i wrote above, or do I have to code that into the program.
I am programing in UNIX, v. 5.8 and and using the g++ compiler.
Any help would be greatly appreciated to help me start off. Thanks for reading