Originally Posted by
CommonTater
Seriously?
Code:
char filename[256];
// put client's filename in filename[]
fp = fopen(filename,"w");
Seems pretty obvious...
I understood that part, i know i have to do the folowing:
Code:
char filename[10];
scanf("%s", filename);
FILE *fp = fopen(filename, "w" );
But that is not my problem, my problem is how do i extract the second string from the buffer. The second string is just the name of the file (test.txt), you can see that on my previous post when i print the buffer. I have a buffer
Code:
char *buffer = malloc(BUFFSIZE);
. that buffer i use for my protocol en for the data to be saved. The question is how do i specifie the filename from that buffer. How do i link those two with each other? I just dont see it.
Code:
scanf("%s %s", &buffer);