Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   How to remove blank spaces and comments while reading data from a file in C? (http://www.go4expert.com/forums/remove-blank-spaces-comments-reading-t9946/)

Shilpa1 11Apr2008 15:46

How to remove blank spaces and comments while reading data from a file in C?
 
Hai,
I want to read data from file and print the contents of the file.While reading it must ignore the blank lines and comment lines.How to do this?Pls help me.

technosavvy 11Apr2008 16:30

Re: How to remove blank spaces and comments while reading data from a file in C?
 
if u r reading the file character by character..ignore the character read whenever there is a space ...tab...newline..or any other white space ...

and if u store the contents in a buffer then traverse the buffer and remove whitespace before printing it ..

to remove comments u should know what a comment in your file looks like..
can a comment be multi-line comment or will it be a single line comment...


All times are GMT +5.5. The time now is 10:58.