BSO
BSO

Reputation: 63

how to redirect output to console window?

I write simple console functions and use freopen to redirect printf statements to a file. Can the output to the file be "turned off" and the printf outputs redirected back to the console window later in the code?

Upvotes: 0

Views: 382

Answers (1)

adripanico
adripanico

Reputation: 1048

fprintf lets you to print to a specific file stream. For example,

fprintf(stdout, "message");

print message in the standard output (the console), so... as you see, printf is just an specialization of fprintf.

I hope this help.

Upvotes: 3

Related Questions