October 5th, 2003, 10:52 PM
Reading Strings with Spaces
I've having a wierd problem with some code I'm working with in which both the scanf and cin functions are reading input with spaces as two seperate strings rather that as one string that happens to contain characters. Is there anyway I can get around this? Thanks,
October 5th, 2003, 11:34 PM
Use fgets() or cin.getline() instead.
#define SIZE 80
fgets(buf, SIZE, stdin);
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
October 6th, 2003, 07:59 AM
October 6th, 2003, 11:15 PM
Thanks, works like a charm.