How am I able to execute my C++ program together with a .DAT file and an input?
For example:
./program.exe file.dat 5
Example of multiple command lines in file.dat:
addpeer 12130
removepeer 13820
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In C++, your use the main function
int main(int argc, char *argv[]), argc contains the “argument count” i.e. the number of your arguments, and argv is a vector containing the arguments you provided when you called your program. In your case it will contain “file.dat” and 5. Once you have this you can parse your file with your program and do what you want with it.