Code:
int main()
{
repeat:
FILE * Tmp;
clrscr();
printf.....
( irrelevant code before the case / switch statement )
case '1':
if((fopen("Pgm.exe", "r+") == 0))
{
printf("\n\nPgm.exe does not exist!\n");
printf("You need Pgm.exe\n\n");
printf("Press any key...");
getch();
}
else
{
fclose(Tmp);
if((fopen("2ndFile.ext", "r+") == 0))
{
printf("\n\n2ndFile.ext does not exist!\n");
printf("You need 2ndFile.ext\n\n");
printf("Press any key...");
getch();
}
else
{
fclose(Tmp);
system("PgmName");
}
}
goto repeat;
break;
Access denied.
Where am I messing up? I know I'm not closing the file somewhere. Possibly I read the file the wrong way? I'm using the open "command" to see if the file exists. If it does it will take action. I am also trying to use a way that does not write, save, or change the file in any way so it may be used if it is detected.
I check for the existance of the program's engine, then if it exists I check for the existance of the secondary file which is loaded -through- the program's engine. If they both exist, it loads the secondary file through the program's engine by calling the program package's name.