if I have a command-line argument such as:
./KR<alice.txt -x -n course
and if my main function is:
main(int argc, char *argv[])
how many arguments (argc) I have?
I need some support...
Printable View
if I have a command-line argument such as:
./KR<alice.txt -x -n course
and if my main function is:
main(int argc, char *argv[])
how many arguments (argc) I have?
I need some support...
You can always try printing the value of argc if you're unsure. In this case, the "<" character will most likely (depending on your shell) redirect the contents of alice.txt to stdin.
I would guess your shell would consume everything to the right of < in processing the redirection (maybe, I didn't try it).
The usual convention would be
./KR -x -n course < alice.txt
That is command line options precede filenames and redirections.