Another OLDBY/NEWBY question

Matthew_HubbardMatthew_Hubbard Posts: 2Member
edited August 2012 in XCode
I have a C program that compiled and allegedly run under XCODE, but I used fopen(), fprintf() and fclose(), so I expected the program would create a text file I could then check out.  No such file exists as far as I can see. Any idea what I am doing wrong?


  • Sort by PointsDate Added
  • Matthew_HubbardMatthew_Hubbard Posts: 2Member
    Here are the lines that I expected would open, write and close the file.

            FILE *fopen(), *fp1;
            fp1 = fopen("covOUT.txt", "w+");
               fprintf(fp1, "%c%c %d ", state_names[i][0], state_names[i][1], state_EV[i]);

  • oliver36oliver36 Posts: 3Member
    I had the same problem in PHP,I solved the problem by setting the correct rights for the file.
    You can do this via terminal,just navigate the terminal to the right directory and now tip in "chmod a+rwx namofyourfile.suffix" now it should work.
    P.S:To change the directory just tip in "cd",drag the file into the terminal and finally tip enter.
Sign In or Register to comment.