say a I have a function with many printf statements and at the end of it I want to add an option to save the already printed items to a text file.
Ex:
void print_Items(float a, float b, float c){
printf("%f", a);
printf("%f", b);
printf("%f", c);
printf("s", "Press s to save above list to a file or q to quit");
ch = getchar();
switch (ch){
case 's':
PRINT TO FILE
break;
case 'q':
break;
}
I want to avoid creating another similar function that just specifically generates and prints the same contents to a file