Frage

I have a c++ program that needs command line arguments like this

./Program textfile.txt argu1 10 

It then gives an output on command line, using cout.

However, is there an easy way of inputting

./Program textfile.txt argu1 10 
./Program textfile.txt argu1 20 
./Program textfile.txt argu1 30 

I need the output in a text file because I need to run 100 of these.

I rather not do it manual...

War es hilfreich?

Lösung

If you are working in bash shell, you can use:

for i in $(seq 10 10 1000)
do
  ./Program textfile.txt $i >> ouitput.txt
done
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top