我一直在尝试使用emscripten。但是,尝试在node
中获取任何输入会使其变得愚蠢(或完全忽略输入。)
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <emscripten.h>
int main(void){
//fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK);
int number;
printf("Please enter a number.\n");
scanf("%i", &number);
printf("This is a compile test for emscript. \n By the way, your number was: %i",i);
}
我已经查看了这个link,这个link(其中一些显然是过时的)以及一些旨在与--pre-js
一起使用的示例文件。没什么似乎工作。
我开始认为我是一个白痴,因为谷歌正在搜索&#34; emscripten scanf&#34;因为去年只显示了一页完全没用的结果,所以我假设我错过了一些明显的东西。
无论如何,我可以得到的唯一结果包括:node
在使用scanf时挂起,节点忽略scanf,或者节点允许您在scanf工作之前无限次地输入。
谷歌搜索&#34; emscripten stdin&#34;稍微有点富有成效,提供this&#34;推荐&#34;通往..... aww,我在开玩笑吧。 (但我希望我已经证明我在放弃和询问之前已经付出了一些真正的努力。)
提前致谢。
(PS:当使用html版本时,这似乎反映了节点行为,循环对话框等等。)
编辑:此示例在网络浏览器中有效 - 它为我提供了提示屏幕,否则看起来非常正常(但提示会一遍又一遍地循环播放。)