Am I correct?
No, but you are close.
It is my understanding that this means I am executing a program named prog
that takes a directory as it's parameter (in this case stop_words_dir
) and uses a specific file from that directory named chapter.txt
You're executing a program named prog
that takes any number of passed in arguments, in this case 1 (stop_words_dir
), and you're redirecting standard input to the contents of chapter.txt
, which is in the current directory (./
) it may or may not be in the stop_words_dir
directory.
Note that the argument stop_words_dir
has to be handled in the program by using the second index of argv
, which is argv[1]
.
If so, is this format Unix (more specifically bash) specific?
I'm fairly certain that this is Unix specific, but I'm not positive.
What does the equivalent command in Windows look like?
A Google search should provide you with the basic Windows cmd
command to execute a program with one argument and redirected standard input.
What is the benefit to using the '<' as opposed to a second parameter
<
basically means switch keyboard input with the content of the input stream given, or redirect standard input. A second command argument would have to be dealt with differently, for example opening and reading from a file.
How would I access chapter.txt in a C program (with the given format. I am aware of how to do this with two parameters)?
The contents of chapter.txt
are read using methods in C
to retrieve keyboard input from a user, like scanf
.