Okie dokie. I've been working on my log file player. I've run into a problem. Here is the code I have. However it doesn't print off the log file. It just loads the log file, then jumps to the last printf. Also I get implicited delcaration of 'pause'. Not sure how to get rid of that.
Code:
#include <stdio.h>
#include <string.h>
#include <dos.h>
int main(void)
{
FILE * log_file;
char log_file_name[20];
char log;
printf("Enter the name of the log to be played.\n");
gets(log_file_name);
if (log_file_name != NULL)
{
printf("Loading log file.\n");
}else{
printf("Please enter a log file.\n");
gets(log_file_name);
return 0;
}
while (1){
log = fgetc(log_file);
if(log !=EOF ){
printf("%c", log);
}
else if (log == '<')
{
pause(1);
continue;
}else{
break;
}
}
printf("Log completed. Thank you for watching. Come back next time.\n");
fclose(log_file);
return 0;
}