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)
Comments
Post a Comment