Inputting files into my program

I need help with reading text files and displaying them on my output file
Example: My text file has integers listed: 9 7 5 14 29 30 27 47

then my program is supposed to display them on one line. I need help with this! Thanks
This looks like a blatant attempt at being lazy and not researching what you need to do. I will not post any code but will provide links on where you can find out how to do this:

File Handling:
http://www.cplusplus.com/doc/tutorial/files/
http://www.cplusplus.com/reference/iostream/fstream/

Don't start a thread with no specific code related problems and just ask for help i.e. "Please give me the code to solve this problem". If you want our help. Attempt the code, if you run into problems. Post the problematic code here and ask questions about it.
Last edited on
I am not being lazy, I am having difficulty with this specific task thank you very much. I will look at the sites you reccomended but thanks for your rude reply.
You are being lazy. You could of Googled "c++ reading text files" and got those links. Instead you start this post with the problem and no attempt to solve it. If that is not case definition of "lazy" then I don't know what is.
Last edited on
I did google it and I cannot figure out how to use the information i have been given based on what google says. I am sorry I need a little help.
Which code are you having a hard time understanding?
I understand how to retrieve the file and make the program read it with fsrteam and inFile, the part i am having trouble with is how to display it on the output screen after the file has been read.
Use cout e.g.

std::cout << fromFile;

Here is a tutorial:
http://www.cplusplus.com/doc/tutorial/basic_io/
Last edited on
Topic archived. No new replies allowed.