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...
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.