【发布时间】:2015-05-05 00:59:08
【问题描述】:
我正在尝试让一个简单的命令行应用程序在NaCl Development Environment 中运行。但我不明白为什么它不想打开文件:
#include <stdio.h>
#include <ppapi_simple/ps_main.h>
int my_main (int argc, char ** argv) {
FILE * f = fopen ("out.txt","w");
if (f) {
fputs ("output to the file", f);
fclose(f);
} else {
puts("could not open file");
}
}
PPAPI_SIMPLE_REGISTER_MAIN(my_main)
跑步:
bash.nmf-4.3$ gcc -I"$NACL_SDK_ROOT/include" test.c -lppapi_simple -lnacl_io -lppapi
bash.nmf-4.3$ ./a.out
could not open file
bash.nmf-4.3$
应用程序显然可以在开发环境中的任意位置打开文件 - 我正在使用 nano 来编辑测试代码!但是 naclports 版本的 nano doesn't look like it's been changed 以直接连接到文件操作的方式..?
Lua 是 appears to have only been modified very slightly 的另一个应用程序。它介于两者之间,因为它可以运行测试文件,但前提是它们位于/mnt/html5 中,并且不会从主文件夹加载它们。如果我将其更改为查看/mnt/html5,我的测试程序在行为上没有任何差异。
注意。我的目标是构建一个终端应用程序,我可以在开发环境中与 Lua 和 nano 等一起使用,而不是基于浏览器的应用程序 - 我认为这会对文件处理规则产生一些影响。
【问题讨论】:
标签: c google-chrome file-io google-nativeclient