This topic is now archived and is closed to further replies.

String Woes

This topic is 6575 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just reading up on that. cin.getLine(string str) will get you a whole line of text. In fact, so will cin.get(char *str, int numChars) will get you <= numChars from the input stream. In that case you'd normally use 80 for numChars (80's the width of a normal dos window).
As far as STL stream documentation goes it is pretty scarce on my compiler help file system, and for that matter, in a lot of on-line STL tutorials/guides. Someone had a link in a previous post to the pre-print Thinking In C++ 2nd edition book that's in PDF format. I'm imagining that contains a lot of good reference of both STL and streams.

BTW, STL's pretty cool once you get the hang of it.


[This message has been edited by joeG (edited December 15, 1999).]

Share this post

Link to post
Share on other sites
Look at my code for an echo program...


void hello(char* Super)
for(int index = 0;index<256;index++)

void main()
char* Super;
Super = new char[256];
memset (Super,32,sizeof(char)*256);
cout<<"Input somethin fo my ass to repeat\n:";
delete Super;

Everything works, except when the user types in spaces(null terminators or something...) How do I make it work if for example the user inputed: "Yo, wassup my main man?"


Share this post

Link to post
Share on other sites