Skip to content

Commit

Permalink
Merge pull request #320 from hahnjo/fprintf-stdout
Browse files Browse the repository at this point in the history
Redirect fprintf(stdout, ...) to std::cout
  • Loading branch information
SylvainCorlay committed Mar 23, 2020
2 parents c2ea092 + 4fc6204 commit 5b02132
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ namespace xcpp
va_start(args, format);

int ret;
if (stream == stderr) {
if (stream == stdout || stream == stderr) {
std::string buf = c_format(format, args);
std::cerr << buf;
if (stream == stdout) {
std::cout << buf;
} else if (stream == stderr) {
std::cerr << buf;
}

ret = buf.size();
} else {
Expand Down

0 comments on commit 5b02132

Please sign in to comment.