write two different files using same function

closed account (1vf9z8AR)
I cant understand how to create a function named 'write(filename)' which lets the user write into the file named file1 or file2.

my main would be something like
write(file1);
write(file2);
A function that takes a parameter for the file name may look like this:

1
2
3
4
5
6
7
8
void write(const char *filename); // Prototype

...

void write(const char *filename)
{
...
}
Topic archived. No new replies allowed.