Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7650 Discussions

New functions for reading files iostream etc

Andrew_N_1
Beginner
124 Views

its been a fair while since I did c and c++ at university. What I'd like to know is what functions and headers are best for reading text from a file. I'm looking to read engineering data such as floats , doubles etc written as text in the file in various formats I.e some lines may have 4 floats and others may be more or a mix of text and floats. Is there a faster way than using sscanf and reading a line by fgets?

 

 

0 Kudos
1 Reply
Yuan_C_Intel
Employee
124 Views

Hi,

Searching from internet there are quite a lot of solution on this.

Using C++ iostream, read floats from text can be very simple. For example, see answer from:

http://stackoverflow.com/questions/8421170/read-floats-from-a-txt-file

Hope this helps.

Thanks.

Reply