I am making a game and i want to to have multi player support.

What i mean is that....

When you load from the save file, you have to write the file name right?

FILE *out;
   out = fopen("datafile.dat", "r+b");

How can you let the player choose which file they want to load?


Are there another way that you can have multi player support?

That's more like multi-profile support, rather than multi-player support.

For what you want, just prompt the user for the filename they want to load, rather than hard-coding "datafile.dat" in the source code.

or you could pass in the name of the file on the command line

int main (int argc, char **argv)
    char filename[MAX_FILENAME_LEN];
    if (argc>1)

    if (fopen(filename,"r+b") == NULL)
        printf("file <%s> does not exist!\n",filename);


yes, there are ways to use network.

it's called socket descriptors.. But trust me, if you just only "kinda get" how to read a .DAT file from a local drive... well, you don't want to go there just yet.


This article has been dead for over six months. Start a new discussion instead.