Please look at this SIMPLE code
it is not simple for me but I am sure that it is all simple for you. I want create 4 or 5 files and name then like:
filenumber1 filenumber2 filenumber3 .....
I can create then individually but that is just a dirty way to do it:D
I have tried the following code but you can look at the result, and it is not what I am expecting
Code:
Code:
char buffer;
char filenom[] = "filenumber";
const char *myfile = NULL;
int i;
FILE *files[5];
for(i = 1; i < 5; i++)
{
buffer = (int)i;
myfile = (filenom) + i;
files[i] = fopen(myfile, "w+");
cout<<myfile<<endl;
fclose(files[i]);
}
---------------------------------------------------------------------------------
Result:
It is just making 3 files with the names:
1) ilenumber
2)lenumber
3)lnumber
Why am I getting this result and how can I make the files with the correct name?
Please don't ignore
:confused: