Skip to content

fflush does not flush stdout or stderr in browser environment. #2770

Closed
@juj

Description

@juj

Place the following code in the file test.cpp:

#include <stdio.h>

int main()
{
    printf("hello!");
    fflush(stdout);
    fprintf(stderr, "hello from stderr too!");
    fflush(stderr);
}

and compile with emcc test.cpp -o test.html -s NO_EXIT_RUNTIME=1. Then run the resulting test.html in the browser.

Observed: No text is printed.

Expected: fflush should flush, and both texts should be visible.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions