title: Open file and read from file Objective-c
body: <p>I'm trying to open a file, and read from it.. but I'm having some issues.</p>
  
  <pre><code>FILE *libFile = fopen("/Users/pineapple/Desktop/finalproj/test242.txt","r");
  char wah[200];
  fgets(wah, 200, libFile);
  printf("%s test\n", wah);
  </code></pre>
  
  <p>this prints: \377\376N test    rather than any of the contents of my file.</p>
  
  <p>any idea why?</p>
  
  <p>complete code:</p>
  
  <pre><code>#import &lt;Cocoa/Cocoa.h&gt;
  #import &lt;stdio.h&gt;
  
  int main(int argc, char *argv[])
  {
  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  
  FILE *libFile = fopen("/Users/pineapple/Desktop/finalproj/test242.txt","r");
  if(libFile){
  char wah[200];
  fgets(wah, 200, libFile);
  printf("%s test\n", wah);
      }
  [pool drain];
  return 0;
  
  }
  </code></pre>
  
  <p>And the test242.txt doesn't contain more than 200 chars.</p>