Hi again.
Finally, I'm done with my assignment... except for one thing !!
It seems the specification sheet I got for the assignment didn't provide where.
However, an example was given. Example is to use a server then two clients (as the server's argument). What happens here when I run two client examples, they write and read from where they are located.
When it's about my program ( I used Visual C 2005 ), the read/write happens in the .../(projectname) file.
Is there a way to make my program portable and let it read wherever it the (projectname).exe is located, or should it be specified ?
my read example:
Code:
void main(int argc, char* argv[])
{
int i, t;
for (i=0 ; i<argc; i++)
extractFileName(argv[0]);
for (t=1; s->tank1Alive=="true" && s->tank2Alive=="true"; t++)
{
FILE *outfile, *infile;
char buffer1 [30]; // for STATE file
sprintf(buffer1, "p%dt%03d.state", i, t);
infile = fopen (buffer1,"r");
fscanf(infile, "%*s %d %d\n",&s->mapDimensionsX, &s->mapDimensionsY);
}
}
Thanks for reading my problem