I had this bit of code, and it worked fine
#include
#include
void readfile()
{
FILE *in;
if((in=fopen(loc[world],"r"))==NULL)
{
perror("Error while loading a data file");
exit(1);
}
fclose(in);
}
okay, and here is my current code
#include
#include
void readfile()
{
FILE *in;
FILE *wlist;
if((wlist=fopen("world.txt","r"))==NULL)
{
perror("Error while loading world list");
exit(1);
}
fclose(wlist);
if((in=fopen(loc[world],"r"))==NULL)
{
perror("Error while loading a data file");
exit(1);
}
fclose(in);
}
all of a sudden, my new code doesn''t work. It says the world.txt file doesn''t exist. I''M LOOKING AT IT RIGHT NOW! IT''S IN THE SAME DIRECTORY! The file contains a list of all the rooms. Without it, the next file can''t be opened. What am I doing wrong?
I did something stupid while trying to figure this out. I took exit(1) out of the first attempt to open a file. DOS threw some kind of error, but I didn''t have time to read it because my computer shut down ALL ON IT''S OWN! That frickin'' pissed me off right there.
shut up
CAN I GET A WOO WOO!