Test locally

How do I test my program on local machine with a provided input file.
Many contest (like Google CodeJam) provide a input file and you have to submit the output file as well as the source code.
So, please tell me how to produce the output file. I tried it by adding this –
But when i build and run the program it terminates and doesn’t writes completely the output of all the input in the input file. (it just wrote 3 output instead of expected 100 in Problem A of google Codejam Practice…!)
thank you.