If I had an array of integers I wanted to output to a text file..
void output()
{
for (i=0; i<10; i++)
printf("%d ", values[i]);
}
How can I save the output() to text file using the method below?
void writeToFile()
{
file = fopen("file.txt","a+"); // apend file or create a file if it does not exist
fprintf(file,"%d", *missing parameter*); // write
fclose(file); // close file
printf("File created. Located in the project folder.
", "");
}
See Question&Answers more detail:os