将命令行参数传递给emscripten生成的应用程序 [英] Passing command-line arguments to an emscripten-generated application

查看:181
本文介绍了将命令行参数传递给emscripten生成的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Emscripten编译C程序时,会生成一个HTML页面,用于显示程序的结果。我想知道如何将命令行参数传递给应用程序。例如,使用原始C程序,它是 ./ bfs 32 1

When a C program is compiled with Emscripten, there is an HTML page generated that will display the results of the program. I was wondering how you could pass command line arguments to the application. For instance, with the original C program it's ./bfs 32 1.

推荐答案

我能够通过在生成的.html文件中添加一行来传递命令行参数。不确定这是否是正确的解决方案,但它有效。
声明了 var模块。只需在下面添加以下行:参数:['32','1'],

I was able to pass command line arguments by adding a line to the generated .html file. Not sure if this is the correct solution but it worked. There's a var Module declared. simply add the following line underneath: arguments: ['32', '1'],

这篇关于将命令行参数传递给emscripten生成的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆