title: Read a file in c on mac desktop 11db error
body: <p>I'm a student learning C for the first time.  I typed in an example the professor gave the class, which is supposed to read in some integers from a file called "input.txt". </p>
  
  <p>Here's the code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
      FILE *ifp;
      int num = -1, sum = 0;
  
      ifp = fopen("input.txt", "r");
      while (num!= 0) {
          fscanf(ifp, "%d", &amp;num);
          sum +=num;
      }
      fclose(ifp);
      printf("The sum is %d.\n", sum);
      return 0;
  }
  </code></pre>
  
  <p>I'm trying to get this program to print out the "sum" like it should, but when I run it, there are no errors yet the only output I get is (11db).  </p>
  
  <p>I created a file called "input.txt" and saved it to the desktop, but it's not working.  </p>
  
  <p>The file "input.txt" contains:</p>
  
  <p>1
  2
  3
  4
  5</p>
  
  <p>I don't know if I'm supposed to somehow, somewhere, define the file path or where/how to do this.</p>
  
  <p>Any help is much appreciated.  </p>
  
  <p>Thanks!</p>