K
K S M
The code below causes a run time error. The point it breaks down
is when I call createLog, is there something wrong with the way I open
and close the streams. There seems to be no issues with it when I
compile and run this code under linux but when I use Win NT I get
a "General Protection Fault" SISEGV error.
Please help.
strcpy(&file[0],"backup.txt");
strcpy(&file2[0], file);
stream = (void *)malloc(4);
stream = fopen(&file[0], "r");
if(!stream){
printf("File %s NOT FOUND! \n\n\t...Program Terminating...\n", file);
exit(0);
}
quit = 0;
scanf("%c", &entry);
if(entry =='s'){
/* backup is a method that I have written... */
backup(stream);
fclose(stream);
free(stream);
stream = fopen(&file2[0], "r");
/* Create Log is a Method that I have written... */
createLog(stream);
free(stream);
printf("\n");
}
is when I call createLog, is there something wrong with the way I open
and close the streams. There seems to be no issues with it when I
compile and run this code under linux but when I use Win NT I get
a "General Protection Fault" SISEGV error.
Please help.
strcpy(&file[0],"backup.txt");
strcpy(&file2[0], file);
stream = (void *)malloc(4);
stream = fopen(&file[0], "r");
if(!stream){
printf("File %s NOT FOUND! \n\n\t...Program Terminating...\n", file);
exit(0);
}
quit = 0;
scanf("%c", &entry);
if(entry =='s'){
/* backup is a method that I have written... */
backup(stream);
fclose(stream);
free(stream);
stream = fopen(&file2[0], "r");
/* Create Log is a Method that I have written... */
createLog(stream);
free(stream);
printf("\n");
}