Simply opening them should create the files if they don't yet exist, no? Anyway, checking for success shows that it is indeed failing to open.
Code:
void generateRooms(char *roomsDirectory) {
int bufSize = 20;
char *currentFile = malloc(bufSize);
char *prefix = "room_";
int i;
for(i = 0; i < 7; i++) {
snprintf(currentFile, bufSize, "%s/%s%d", roomsDirectory, prefix, i+1);
FILE *f = fopen(currentFile, "w");
if (f == NULL) {
printf("Error: Failed to open %s.\n", currentFile);
exit(1);
}
fclose(f);
}
}
It seems like it really shouldn't be that hard to just create a directory (which has been done), and then create some files in that directory. Any helpful guidance would really be appreciated.