Hi everyone,

I have a cpp code (Let's call it code1.ccp) that reads some data form a file named "InputFile1" and after a few computation writes the results on the file "OutputFile1".What I need to do is to run this piece of code for InputFiles2 to InputFile100 and write the results to OutputFile2 to 100 accordingly. I was wondering if there is a way to change just the number in the code1.cpp and make 100 copies of the cpp code. I want to run them all at the same time.

Thanks in advance,

Recommended Answers

All 3 Replies

It seems like a better solution would be to edit the C++ code to accept input and output file names from the calling process, or run the whole thing in a loop a requested number of times from the calling process.

Each of the cpp codes take about 10hrs to run and I want to submit them on different cpu machines therefore to my knowledge I need to make 100 different jobs/cpp codes to submit.

Does that include compiling the code or are you using a C++ interpreter? Because you don't just "run" C++ source code. Anyway, I can't tell you what's possible or not since you're closer to the problem than I am, but editing the code 100 times with a shell script seems silly from my perspective, especially when the only change is the sequence number after a couple of file names.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.