Garmaine Staff asked 2 years ago

In cpp, I need to run a program like this

g++ *.cpp -o out

./out <input.txt> <somenumber>

where input.txt is a text file containing lines of information I need to proccess, and somenumber is an integer value I need to use.

I am searching for hours and couldn't find the answer I was looking for,

I found solutions that work like

./out < input.txt 

reads the input.txt line as a string which then in the code I can process, but the assignment says that the code will be run only and specifically as

./out <input.txt> <somenumber>

can anyone help ?

I have wrote some code, in which I wrote my main as

int main(int argc, char* argv[] ){

but when I run

./out <input.txt>

the terminal gives an error saying

" -bash: syntax error near unexpected token `newline' "

edit: typo