can scanf retain leading whitespaces
-
Hello, Can scanf be set to retain leading whitespaces in between words? For example, if the string was " Hello everyone, how are you today? " can scanf grab " Hello" " everyone," " how" " are" " you" " today?" Thanks,
Only if you wrote your own parser. The other ideas that I mentioned to you would use the space as the delimiter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Hello, Can scanf be set to retain leading whitespaces in between words? For example, if the string was " Hello everyone, how are you today? " can scanf grab " Hello" " everyone," " how" " are" " you" " today?" Thanks,
You can do this to capture everything till the enter key is hit.
scanf("%[^\n]", sz);
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Only if you wrote your own parser. The other ideas that I mentioned to you would use the space as the delimiter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
You can do this to capture everything till the enter key is hit.
scanf("%[^\n]", sz);
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)