sscanf and c++!

M

Mike

hey ...

is there a better way in ansi c++ for parsing strings similar to how
old c uses sscanf? a function that uses std::string instead of old char's.

have seen some extensions like the boost library but I want to keep
as standard as possible.

thanks

- mike -
 
J

John Harrison

Mike said:
hey ...

is there a better way in ansi c++ for parsing strings similar to how
old c uses sscanf? a function that uses std::string instead of old char's.

You can use sscanf with strings

sscanf(str.c_str(), ...);
have seen some extensions like the boost library but I want to keep
as standard as possible.

boost is not an extension, its a portable freely redistributable library.

john
 
R

Russell Hanneken

Mike said:
is there a better way in ansi c++ for parsing strings similar to how
old c uses sscanf? a function that uses std::string instead of old char's.

Look up istringstream.
 
M

Mike

sorry didnt mean an extension, library of course! will look into the
istringstream ... thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top