title: Going through a text file line by line in C
body: <p>I have been working on a small exercise for my CIS class and am very confused by the methods C uses to read from a file. All that I really need to do is read through a file line by line and use the information gathered from each line to do a few manipulations. I tried using the getline method and others with no luck. 
  My code is currently as follows:</p>
  
  <pre><code>int main(char *argc, char* argv[]){
        const char *filename = argv[0];
        FILE *file = fopen(filename, "r");
        char *line = NULL;
  
        while(!feof(file)){
          sscanf(line, filename, "%s");
          printf("%s\n", line);
        }
      return 1;
  }
  </code></pre>
  
  <p>Right now I am getting a seg fault with the sscanf method and I am not sure why. I am a total C noob and just wondering if there was some big picture thing that I was missing. 
  Thanks</p>