Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why fopen returns NULL? #117

Closed
yushulx opened this issue Oct 22, 2019 · 1 comment
Closed

Why fopen returns NULL? #117

yushulx opened this issue Oct 22, 2019 · 1 comment

Comments

@yushulx
Copy link

yushulx commented Oct 22, 2019

I tried to use fopen to read an image:

#include <stdio.h>

int main()
{
    FILE *f = fopen("1.png", "rb");
    printf("file %p\n", f);
    fclose(f);
}

Build:

$ clang --target=wasm32-wasi --sysroot=/opt/wasi-sdk/share/wasi-sysroot/ test.c -o test.wasm
$ wasmtime test.wasm
$ file 0

But it returned NULL. How can I fix it?

@yushulx
Copy link
Author

yushulx commented Oct 22, 2019

Fixed:

wasmtime --dir=.  test.wasm

@yushulx yushulx closed this as completed Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant