How to remove blank spaces and comments while reading data from a file in C?

Shilpa1's Avatar, Join Date: Nov 2007
Go4Expert Member
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.
0
technosavvy's Avatar
Contributor
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...