Reading text input via input pop-ups is probably only useful debugging. I think the primitive support for reading stdin in this way allows you to get things running quickly, but any production application on the web probably needs to be redesigned such that it gets its input some other more web-friendly way. How do you indent that you users interact with your app?
If you are interested the code in question (that gets input from `window.input` JS API) seems to be here: https://github.com/emscripten-core/emscripten/blob/289befa9cd7120a7d21835b45903993c44b2c593/src/library_tty.js#L133 On Sat, Jan 2, 2021 at 4:52 AM Marnix <[email protected]> wrote: > I’m on Windows 10 and have a pretty large (I think) console application > written in C. 90+ files and about 17.000 lines of code. > > It compiles without errors/warnings in emcc. However, when I run it, the > text input does not seem to work correctly. It keeps popping up the input > window and buffering text. So I went back to basics and to reproduce and > isolate the issue added a scanf() statement to the hello_world program that > comes with the emscripten package: > > =================================================== > /* > * Copyright 2011 The Emscripten Authors. All rights reserved. > * Emscripten is available under two separate licenses, the MIT license and > the > * University of Illinois/NCSA Open Source License. Both these licenses can > be > * found in the LICENSE file. > */ > #include <stdio.h> > > int main() { > char input[25]; > > printf("hello, world!\n"); > printf("Enter input: "); > scanf("%s", input); > printf("\nInput is: %s\n", input); > > return 0; > } > =================================================== > > I compiled the file with command “emcc tests/hello_world.c –o > hello_world.html”. > > This little program has the same issue. It keeps asking for input and only > when I cancel the input window it prints “hello, world!” “Enter input: “ > and “Input is: <what I entered>“. > > The program is at this link on my website so you can see the behavior: > hello_world <https://www.xvan.nl/emscripten/hello_world.html> > > What I don't understand: why is the input window coming back each time and > why is the text buffered until I cancel the input window? > > I did search the group, but actually I don’t know what I’m looking for. > > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/29395d49-9ada-4100-b542-f1e59602137bn%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/29395d49-9ada-4100-b542-f1e59602137bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-3xuGZ%3DZL62%2B-YWPO11txkwGWbKhHUhMuLv-sMtcdArw%40mail.gmail.com.
