I am having trouble reading from a file in c++
Page 1 of 12 Replies - 425 Views - Last Post: 08 October 2012 - 09:03 AM
#1
I am having trouble reading from a file in c++
Posted 08 October 2012 - 07:06 AM
Hey i am trying to read the first line from a file and to read it out the the printout screen. I am new to programming so I am not too sure what i am doing wrong.
Replies To: I am having trouble reading from a file in c++
#2
Re: I am having trouble reading from a file in c++
Posted 08 October 2012 - 07:16 AM
First post your code inside code tags, not a picture of your code. Next you should insure your file opened correctly. See the documentation for ifstream.open().
Jim
Jim
#3
Re: I am having trouble reading from a file in c++
Posted 08 October 2012 - 09:03 AM
Your file should exist in the root directory in which you are working. After opening the file, make sure to check whether the file has opened or not. Use the function is_open () for that purpose.
As mentioned above, check the documentation of ifstream library functions and file handling input method.
As mentioned above, check the documentation of ifstream library functions and file handling input method.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|