Reputation: 55
I want for main function in c program, read argc and argv from file.
How to read argv and argc from file in C language?
For example:
./prog --test=cpu --prime=1000 run
Change to:
./prog file.txt
File.txt is:
--test=cpu --prime=1000 run
Prog is a very big program.
Upvotes: 0
Views: 82
Reputation: 212949
You don't need to change the program, you can just do something like this:
./prog $(cat file.txt)
(assumung bash or similar shell).
Upvotes: 3