Skip to content

Commit

Permalink
Merge pull request #14 from osm/fix-output-buffering
Browse files Browse the repository at this point in the history
Disable std{out,err} buffering
  • Loading branch information
tcsabina authored Feb 22, 2025
2 parents 648d7d3 + 8bf666b commit 8760cd7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ int main(int _argc, char *_argv[])

srand((unsigned) time (NULL));

// Disable buffering for stdout and stderr to avoid issues when output
// is redirected to a file or pipe instead of being displayed in a
// terminal.
setbuf(stdout, NULL);
setbuf(stderr, NULL);

// show help ffs
if (argc > 1 && ( !stricmp("-h", argv[1])
|| !stricmp("-?", argv[1])
Expand Down

0 comments on commit 8760cd7

Please sign in to comment.