I got a doubt while working on my IOS project, for our testing purpose, we wrote a piece of code like this in main…
printf("start\n");
FILE *fp = fopen("/Users/gui_test/Desktop/ritun/hello_test/hello_test/expt.txt", "a + b");
int a = 5, b = 5;
int c = a + b;
fprintf(fp, "%d\t", c);
fflush(fp);
fclose(fp);
printf("end \n");
I have commented out the below line in main to test file writing.
return UIApplicationMain(argc, argv, nil, NSStringFromClass([ofi_video_monetAppDelegate class]));
Answer is written into file successfully but twice, Anyone have any idea why is this? Other than main() if I try anywhere else, it is writing only one time, what is happening in main.
Returning 0 by commenting out the following line causing the main called twice internally,
I have returned 1, it works fine, one entry in file, no duplicates.