Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualKhatharr

Posted 21 January 2013 - 02:42 AM

Nothing's jumping out at me apart from the fact that you don't test the return from fopen(). If you walk through it with the debugger can you see anything unusual (such as a negative 1 from fsize() getting passed to malloc())?

#2Khatharr

Posted 21 January 2013 - 02:37 AM

ninja'd - one sec while I read that.

#1Khatharr

Posted 21 January 2013 - 02:36 AM

<pre class="_prettyXprint _lang-code _linenums:NaN">  fseek(file, 0, SEEK_END);
  int fileLength = ftell(file);
  fseek(file, 0, SEEK_SET);</pre><br />Remember to close your FILE pointer when you're done or you'll leak handles.

PARTNERS