16 char* input = (char*) argv[1]; 17 FILE *fp = fopen (input, "r"); 18 if( fp == NULL) 19 { 20 printf(" reading input file failed"); 21 return 0; 22 } 23 fseek(fp,0,SEEK_END); 24 int file_size = ftell(fp); 29 rewind(fp); 30 int i; 31 int totalRun; 32 char * temp; 33 char* model; 34 char* example; 36 fscanf(fp,"%d",&totalRun); 37 fscanf(fp,"%s",model);
Above is my code I get this error at line 37 "fscanf(fp,"%s".model)"
Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5fc00730 0x00007fff8db20bcb in __svfscanf_l ()
What can cause this ?? I looked into *fp in gdb. before reading totalRun _offset = 0 and after reading _offset = 4096. content of totalRun was correct ("3"). I only read one line and why is offset 4096? Also what is _blksize referring to in FILE.
Thank you