fopen - fscanf reads incorrect value ? -Xcode -


i've placed file.rtf in directory library/developer/xcode/deriveddata/test(projectname)/build/products/debug , code seems open prints out wrong output.the output 1606422622 integer value in file.

going through solutions of question similar mine ,the answers input file in right directory.i think i've done can't correct output.

desperate help.thanks.

int main() {   int b;   file *fp;   fp=fopen("file.rtf","r");   if (fp == null) {     printf( "file doesn't exist!\n");   }   fscanf(fp,"%i",&b);   printf("%i\n",b);    fclose(fp);   } 

looks trying read rtf formatted file. try saving file 'plain text file' in textedit. (with extension .txt)

enter image description here


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -