• Advertisement
Sign in to follow this  

File I/O in C++

This topic is 4416 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm doing some things with File I/O in C++ right now. My question is, is there a way to read in a line into a variable of type double instead of a string? For example, say the text file that I am reading in appears like this: 12.32 223.21 123.64 Is there any way to read the entire line into a variable of type double instead of a string so that I can compare them?

Share this post


Link to post
Share on other sites
Advertisement
Slight correction to both posts, the correct header is <fstream>.

[smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by Mxz
Slight correction to both posts, the correct header is <fstream>.

[smile]


why not use #include <ifstream> if its only for input?

Share this post


Link to post
Share on other sites
Quote:
Original post by philipptr
Quote:
Original post by Mxz
Slight correction to both posts, the correct header is <fstream>.

[smile]


why not use #include <ifstream> if its only for input?



Because the header <ifstream> does not exist.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement