C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Read file of multiple data types.

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Oct 27, 2006 9:10 am    Post subject: Read file of multiple data types. Reply with quote



I have a file where I know the lines go as follows:

string
long
string
int
int
string
double

it then repeats this sequence multiple times. I can use getline() to
get the data, but I need to be able to use the ints, doubles, and longs
without them being strings or char[]. The strings also have an unknown
amount of spaces in each one, so i can't use >> to get the data. At
least not that I can get to work. Is there a way to get the different
data into variables of the correct types? If there is a way to convert
them after I use getline() that would work too.
Back to top
David Harmon
Guest





PostPosted: Fri Oct 27, 2006 9:11 am    Post subject: Re: Read file of multiple data types. Reply with quote



On 26 Oct 2006 23:13:08 -0700 in comp.lang.c++,
computerwolf8 (AT) gmail (DOT) com wrote,
Quote:
I can use getline() to
get the data, but I need to be able to use the ints, doubles, and longs

strtod()
strtol()
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.