New question about file handling. I have problem getting this file handling 
working. It must be a simple mistake somewhere. Steps taken:

1. On OSX Mavericks copy this 
file https://github.com/kripken/emscripten/blob/master/tests/files.cpp to 
my local Desktop.
2. Create a file on the Desktop named "somefile.binary" (in this case some 
random png file renamed)
3. Go to terminal, go to Desktop folder.
4. type "emcc files.cpp"
5. a.out.js and a.out.js.map are generated (as expected). Here is "ls -al" 
listing:

-rw-r--r--   1 username1  staff  332757 Mar  4 18:12 a.out.js
-rw-r--r--   1 username1  staff      69 Mar  4 18:12 a.out.js.map
-rwxr-xr-x@  1 username1  staff    2846 Mar  4 18:11 files.cpp

-rw-r--r--@  1 username1  staff   45189 Feb 19 10:53 somefile.binary
 

6. type "node a.out.js"
7. An exception is thrown at the very first assert:

/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:9313
      throw e;
            ^
Assertion failed: file, at: files.cpp,11,main at Error
    at stackTrace 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:941:15)
    at ___assert_fail 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:3558:210)
    at Object._main 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:5719:2)
    at Object.callMain 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:9296:30)
    at doRun 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:9336:25)
    at run 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:9349:5)
    at Object.<anonymous> 
(/Users/username1/Desktop/emscripten_try/my_first_app/a.out.js:9392:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)


8. In case it's related to permissions "chmod 777 *" changed to enable all 
permissions in the directory but same result.

9. The code that is crashing is the very first assert:

int main()
{
  // Reading

  FILE *file = fopen("somefile.binary", "rb");
  assert(file);
  ...


10. "node a.out.js" worked on Hello_world.cpp so it doesn't seem like my 
setup is wrong.

11. As expected "c++ file.cpp" creates a working "a.out" which ran fine.


What could I be doing wrong?

Please any help greatly appreciated. Thanks,
Wowi



-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to