title: fprintf stops printing into file partway
body: <p>This is a part in my code which is used to save all the information to a text file which is then used to load into my program later. Somehow the <code>fprintf</code> never printed everything i needed it to and always stopped midway.</p>
  
  <p>Code:</p>
  
  <pre><code>for(int frames=0;frames&lt;MAX_FRAME;frames++)
  {
      fprintf(saveFileStream,"frame=%d xOffset=%d yOffset=%d delay=%d\n",frames,frame[frames].offset[XPOS],frame[frames].offset[YPOS],frame[frames].delay);//saves frame properties
      for(int xPos=0;xPos&lt;MAX_X_COORDINATE;xPos++)
      {
          for(int yPos=0;yPos&lt;MAX_Y_COORDINATE;yPos++)
          {
              if(frame[frames].particle[xPos][yPos].p!=' ')//skips blank characters
              {
                  fprintf(saveFileStream,"frame=%d xPos=%d yPos=%d particle=%c\n",frames,xPos,yPos,frame[frames].particle[xPos][yPos].p);//saves particles
              }
          }
      }
  }
  </code></pre>
  
  <p>and when this code is executed, it prints:</p>
  
  <pre><code>frame=0 xOffset=0 yOffset=0 delay=200
  frame=1 xOffset=0 yOffset=0 delay=200
  frame=2 xOffset=0 yOffset=0 delay=200
  frame=3 xOffset=0 yOffset=0 delay=200
  frame=4 xOffset=0 yOffset=0 delay=200
  frame=5 xOffset=0 yOffset=0 delay=200
  frame=6 xOffset=0 yOffset=0 delay=200
  frame=7 xOffset=0 yOffset=0 delay=200
  frame=8 xOffset=0 yOffset=0 delay=200
  frame=9 xOffset=0 yOffset=0 delay=200
  .
  .
  .
  frame=203 xOffset=0 yOffset=0 delay=200
  frame=204 xOffset=0 yOffset=0 delay=200
  frame=205 xOffset=0 yOffset=0 delay=200
  frame=206 xOffset=0 yOffset=0 delay=200
  frame=207 xOffset=0 yO
  </code></pre>
  
  <p>(<code>MAX_FRAME</code> is 256)</p>
  
  <p>What confused me the most is that it didn't stop after a line, but stopped while printing <code>yOffset</code> at frame 207.</p>
  
  <p>If i set <code>MAX_FRAME</code> to a smaller number, it still stops printing before the counter <code>frames</code> reaches it.</p>