Actually, this is a very common method used in programming tournaments. The data needed by your program is stored in a file, say data.txt, and then redirected to your application using the "<" on the shell, for example: ./program <data.txt
So, in your source code, what you need to do is something like this:
#include <iostream> #include <string> using namespace std; int main(void) { string tmp; string full_content; while (cin >> tmp) full_content += " "+tmp; cout << full_content << endl; }
.. and you will get all the data from the file in a line (and separated by spaces).
This way to do it, hope this helps. [] 'S
source share