*frustrated sigh* Can anyone tell me why this program prints the first printf statement, and then prints all the newline statements in the next printf but does a segmentation fault when it gets to the word test?? I think the rest of the code should work, but i can't get past that point. And if i take that printf statement out, i still get a segmentation fault. anyone?
Code:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#define N 25
int main(int argc, char* argv[]){
FILE *fp;
struct timeval gtodTimes[N];
char *procClockTimes[N];
int i=0, LENGTH = 25;
time_t now;
/*Get current time*/
now = time(NULL);
printf("\n\tStatus report at %s\n", ctime(&now));
printf("\t\n\n\n\ntest");
fp = fopen("/proc/clock", "r");
for (i=0; i<N; i++){
gettimeofday(>odTimes[i],0);
fgets(procClockTimes[i], LENGTH, fp);
}
for (i=0; i<N; i++){
printf("The time of day is %d and something %s", gtodTimes[i],
procClockTimes[i]);
}
fclose(fp);
exit(0);
}