- This topic has 1 reply, 2 voices, and was last updated 15 years, 1 month ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › WhiteSpaces and Blank Lines
Hi,
Need help for a ‘C’ Code to ignore WhiteSpaces (Carriage Return, Enter, etc) and Blank Lines while reading an input file.
Thanks,
Marconi.
I’m not sure what compiler your using but the include file ctype.h has a macro called isspace() that can be called on characters , like:
1 2 3 4 5 6 7 | <br /> char ch = cin.get()<br /> if ( isspace ( ch ) )<br /> {<br /> cout << "read a space" ;<br /> }<br /> |
The definition is listed as
The isspace() function returns non-zero if its argument is some sort of space (i.e. single space, tab, vertical tab, form feed, carriage return, or newline). Otherwise, zero is returned.