dayana42200
Junior Member level 3
Dear all,
How can I write the displayed output in the command prompt to a text file?
tq very much.
How can I write the displayed output in the command prompt to a text file?
Code:
#include<stdio.h>
#include<string.h>
int main()
{
/*declare and initialise variable*/
char message[32][114],buffer[114];
int i=1;
FILE *file_in;
FILE *file_out;
file_in=fopen("exon11.txt", "r");
file_out=fopen("1.txt", "w");
/*stores and prints the data from the string*/
while(fgets(buffer,114,file_in))
{
strcpy(message[i],buffer);
fputs(message[i],file_out);
printf(">%d\n%s\n",i,message[i]);
i++;
}
getchar();
return 0;
}
tq very much.