Home Forums C Programming Read all the lines from a file

Viewing 0 reply threads
  • Author
    Posts
    • #1984
      rana_sandeep
      Participant

      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.

Viewing 0 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.