title: Modify an integer value in a textfile in C
body: <p>Lets say I have a text file like this:</p>
  <pre><code>106
  60
  107
  50
  108
  37
  </code></pre>
  <p>So the 106 107 and 108 are my IDs and the 60, 50 and 37 are stock quantities. And I want to modify the stock quantities like let's say Iadd 30 more to ID:106, so it should be 60+30=90. So my question is, how should I code it so it updates the text file.</p>
  <p>I have already tried to scan the file into an array but it doesn't seem to scan the data into the array:</p>
  <pre><code>while(fscanf(filename, &quot;%d&quot;, array[i]))
  {
      i++;
  }
  </code></pre>
  <p>I tried that method and it doesn't seem to work. Is there any alternatives with this problem?</p>