I am a beginner in learning C language :-)
I have searched how to solve this in stackoverflow, but nothing I can understand. :-(
Before posting this thread, I always redirect stdout to a file, and then read it to a string by using fread
system ("print.exe > tempfile.tmp");
FILE *fp = fopen ( tempfile.tmp , "rb" );
char Str[Buf_Size];
fread (Str,sizeof(char),Buf_Size,fp);
If doing so, it'll waste lots of time in File I/O.
How can I redirect stdout to a string in C Language without redirecting to a tempfile?
Is it possible? Thanks.
Environment:
Windows and GCC