I was wondering if anyone could give reference to where I might find something on user defined output file names. I looked up different sites, even books but nothing explains how to do it. This is not for homework. I'm preparing for exams.
This is an output function that I have. What I want is for "answerData.txt" to be renamed to any .txt file. I did read somewhere that there was a function called rename(), but I don't know how to implement that.
Code:
void file_output(linear_eq num){
FILE* fp;
fp = fopen("answerData.txt", "a");
printf("%d %d %d\n", num.x, num.y, num.eq);
fclose(fp);
return;
}
Any help on this would be greatly appreciated. Thank you.