#include <iostream>
using namespace std;
int main() {
char name[128];
cout << "type your name:\n";
cin.getline(name, sizeof(name));
cout << "hi, " << name << endl;
return 0;
}
I've try fflush(stdout) too, but unfortunately it does not help.
After text input done cout works as expected:
type your name: (input dialog shown and 'Anton' is typed)
hi, Anton
--
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 emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
Hi. Thanks for reply. I've tested print with '\n' and it works in chrome as expected (emscripten 1.25). But it does not work in safari (I can't see print before input dialog shown)
--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/5EN4FxJwYUU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/5EN4FxJwYUU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
Few topics ago i've asked similar question and i was answered that printf needs '\n' or fflush() to force output. That works great in Google chrome but unfortunately does not work in Safari (which is default browser and widely used on mac). How can i force output or workaround it (i agree it can be Safari's bug/feature though)?
function _main() {
var $name = 0, $vararg_buffer = 0, $vararg_buffer1 = 0, $vararg_buffer3 = 0, label = 0, sp = 0;
sp = STACKTOP;
STACKTOP = STACKTOP + 96 | 0;
if ((STACKTOP | 0) >= (STACK_MAX | 0))
abort();
$vararg_buffer3 = sp + 16 | 0;
$vararg_buffer1 = sp + 8 | 0;
$vararg_buffer = sp;
$name = sp + 24 | 0;
(_printf((8 | 0), ($vararg_buffer | 0)) | 0);
HEAP32[$vararg_buffer1>>2] = $name;
(_scanf((32 | 0), ($vararg_buffer1 | 0)) | 0);
HEAP32[$vararg_buffer3>>2] = $name;
(_printf((40 | 0), ($vararg_buffer3 | 0)) | 0);
STACKTOP = sp;
return 0;
}
Few topics ago i've asked similar question and i was answered that printf needs '\n' or fflush() to force output. That works great in Google chrome but unfortunately does not work in Safari (which is default browser and widely used on mac). How can i force output or workaround it (i agree it can be Safari's bug/feature though)?
MBA-Anton:tmp asmirnov$ node ./input.js
what is your name ?
hi,
Is it something completely broken in my Emscrpten distrib (1.25.0)?