c - EXC_BAD_ACCESS error message in Xcode -
i'm writing project in xcode, , can't seem solve error. i'm aware i'm trying access released/un-initialised object somewhere, or perhaps passing data objet doesn't understand, can't find cause of issue (i.e. line doing this). i've tried debugging using nszombies, , didn't work.
int main(int argc, const char * argv[1]) { const int time_quantum = atoi(argv[2]); int totaltime = 0; int blockedtime = 0; int blocktime[100]; int exittime[100]; int reltime[100]; int spawntime[100]; int processid[100]; char state[100][32]; int microseconds = totaltime * 1000; int currentsector = ((int)((microseconds/1000000.0) * sectors_per_sec)) % disk_sectors; int runningtest; file *fp; fp = fopen(argv[1], "r"); char row[bufsiz]; while (fgets (row, sizeof(row), fp) != null) //error returned here { int time; char eventtype[32]; int pid; int sector; sscanf(row, "%i %s %i %i ", &time, eventtype, &pid, §or);
there more code follows, it's excruciatingly long-winded , convoluted, , don't think has relevance error. initial hunch problem has "fp" call; might have botched file opening , trying call on non-existent object. tried:
while (fscanf(fp, "%d" "%s" "%d" "%d", &time, state, &pid, §or)!= eof){
but, replaced what's there after time. know bad access is? have no clue. file i'm supposed opening sample process schedule file, containing info processes (when spawn, exit , blocked etc.). if nudge me in right direction, appreciate it.
Comments
Post a Comment