Originally posted by novacain
For a start try creating a structure to hold the file details

ie
File handle(return of fopen CreateFile() ect)
string for name of file ie "MattB.txt"


and anything else for the file handling.

then declare an array of the struct and hash define some int indexes

ie
#define MAX_FILES 15
#define MATTB 0
#define DAVEC 1

then you can use for loops to open/validate the files. Use the string in error msg's ect.

If you need a file you can call it with the define
Code:
if(iChoice==MATTB)
{
    FileArray[MATTB].fFile = fopen(  FileArray[MATTB].sFileName ,"w" );
    if(FileArray[MATTB].fFile==NULL)
        sprintf(sErrorBuffer, "File %s has failed to open.", FileArray[MATTB].sFileName );
//ect
This will reduce the length of code and increase readability.
I know this may sound dumb, but how exactly would you implement that? I mean, where would you put:
Code:
if(iChoice==MATTB)
{
    FileArray[MATTB].fFile = fopen(  FileArray[MATTB].sFileName ,"w" );
    if(FileArray[MATTB].fFile==NULL)
        sprintf(sErrorBuffer, "File %s has failed to open.", FileArray[MATTB].sFileName );
and get it working? Sorry if I'm a bit confused on the subject.