istrstream


a code snipet.

char s[] = “1.3 this is a test <><<?!\n";
istrstream ins(s);
char ch;
ins.unsetf (ios::skipws); // don’t skip spaces
while (ins) { // false when end of array is reached
ins >> ch;
cout << ch;
}

Another way to do string separation is to use strtok().

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s