Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fprintf/printf output not displayed without newline #14285

Open
jimmonte opened this issue May 25, 2021 · 1 comment
Open

fprintf/printf output not displayed without newline #14285

jimmonte opened this issue May 25, 2021 · 1 comment

Comments

@jimmonte
Copy link

If a C program does not have a newline at the end of the string passed as an argument to fprintf or printf when generating Wasm from C, the output is not displayed. The first example at https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm with the newline of the printf removed will demonstrate this issue.

`
#include <stdio.h>

int main() {
printf("Hello World");
}

For this example, there is no output from the program displayed on the web page.
`

@kripken
Copy link
Member

kripken commented May 25, 2021

This is because the runtime is not shut down by default. In a debug build you will get a warning on this. For more details see https://emscripten.org/docs/getting_started/FAQ.html?highlight=faq#what-does-exiting-the-runtime-mean-why-don-t-atexit-s-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants