- This topic has 0 replies, 1 voice, and was last updated 17 years, 5 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › Read all the lines from a file
Hello Team,
I want read all the lines from a file using c program using command line arguments. I tried using “fscanf”. I want to eliminate the line start from ‘#’.
But fscanf is reading all the words. Then I tried using fgets and sscanf. But sscanf is reading only first word of a line. How do read all the from a file and each word in a line should take is as separate array.
Ex: I am vasu.
Line:I am vasu
I need output like this:
array 1: I
array 2 : am
arry 3 : vasu
If the line start from # I want ignore that line.
Any inputs are highly appreciate
Thanks in advance
Vasu.