Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Read a text file and assign values to variables int and double
Read a text file and assign values to variables int and double [message #46495] |
Mon, 16 May 2016 10:41 |
281264
Messages: 270 Registered: June 2010 Location: Spain
|
Experienced Member |
|
|
Hi,
Let's imagine that we have a text file with the following format:
1 ____ 100.00
2 ____ 200.00
3 ____ 300.00
.....
There is blank space (represented by the underscores) between the integer numbers in the first column and the double numbers in the second column. Is there any way of opening such a text file and assigning the values to a U++ Vector<int> and Vector<double> containers? In standard C++ (using C++ streams and operator >>) this is simple but how can it be done using U++ Streams (FileIn)? do I have to overload operator >>? is there any simple way of doing it?
Many thanks,
Javier
|
|
|
Goto Forum:
Current Time: Fri Apr 26 00:23:34 CEST 2024
Total time taken to generate the page: 0.04103 seconds
|