I see this in a code challenge before and was wondering if this was the same as passing a parameter to a program?
Echo “string”| program.c
I see this in a code challenge before and was wondering if this was the same as passing a parameter to a program?
Echo “string”| program.c
The shown code will probably not work at all, because program.c
, if named according to the habits of practically any programmer, will be the pure C-code file, the "human readable" form of a program.
To use this in any way as an executable, you first need to build it (compile and link). The result it usually an executable file called program
(or program.exe
on Windows).
That file can be called similarly to the shown code
echo "string" | program
Which makes the string available via the diverse input functions ( https://en.cppreference.com/w/c/io ) and the standard input.
For accessing it as a parameter (using the parameters to main
, function, usually named argc
and argv
; e.g. https://stackoverflow.com/a/47536091/7733418 ), you'd have to call the program like
program "string"