Hi,
for the life of me I cannot get the emscripten_wget of
emscripten_async_wget to work.
I want to use wget to dl a json file I want to parse later, for this I want
to set up a temp file, dl the date, parse and destroy.
However, it complains that the "file exists" of the FS in case of mounting
the MEMFS, or the size is 0 in case of FS.createDataFile..
Help is appreciated.
this is a snippet of the code I have:
void Test2(){
EM_ASM(
// FS.mkdir('/');
// FS.mount(MEMFS, {}, '/');
FS.createDataFile("/", "file.txt", "File contents here", true, true);
);
char *path = "/file.txt";
printf("Downloading...\n");
myurl="http://test.site/json";
// emscripten_async_wget(myurl.c_str(), path, onLoadWget, onErrorWget);
emscripten_wget(myurl.c_str(), path );
printf("Download completed\n");
FILE *json;
json=fopen(path,"r");
if(json==NULL) {
printf("ERROR: Can't open file!\n");
exit (2);
}else{
long size = ftell (json);
printf("size: %ld\n", size);
fputs ("fopen example\n", json);
fclose ( json );
}
}
void onLoadWget(const char* fname){
printf("wget loaded: %s\n", fname);
}
void onErrorWget(const char* fname){
printf("wget failed: %s", fname);
}
--
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/d/optout.