title: C reading from file: Reading only first char of line
body: <p>I have to get node ids from DIMES ASNodes.csv (<a href="http://netdimes.org/new/?q=node/65" rel="nofollow">http://netdimes.org/new/?q=node/65</a>) files. 
  File looks like this: </p>
  
  <pre><code>6067,UNKNOWN,2007-02-03 10:03:53.0,2007-01-02 02:54:13.0,12,6,0
  29287,UNKNOWN,2007-02-03 21:11:07.0,2007-01-02 07:33:35.0,1,0,0
  ...
  </code></pre>
  
  <p>So far I came up with this code, but it doesn't work quite right. Althought it prints out all the numbers I needed, it also prints out the node id twice and sometimes prints zeroes in between. Thanks for any ideas</p>
  
  <pre><code>void loadNodes(const char* filename)
  {
      FILE* nodes = fopen(filename, "r");
  
      unsigned int id = 0;
      char line[64];
  
      while (fgets(line, sizeof(line), nodes) != NULL) {
          sscanf(line, "%u%*[^\n]", &amp;id);
          printf("id = %u\n", id);
      }
      fclose(nodes);
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/sdemM.png" rel="nofollow">output</a></p>