Created
January 13, 2018 02:48
-
-
Save tbfleming/b7fabe92dd2889ef33375a42701dc66c to your computer and use it in GitHub Desktop.
cib demo: emscripten_async_wget_data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Download a file using https. Only works with sites which support CORS. | |
#include <emscripten.h> | |
#include <stdio.h> | |
#include <string> | |
using namespace std; | |
void received(void *, void *data, int size) { | |
puts(string((char *)data, size).c_str()); | |
} | |
void error(void *) { printf("download failed\n"); } | |
int main() { | |
emscripten_async_wget_data( | |
"https://cdn.rawgit.com/llvm-mirror/clang/" | |
"3bddc261ddb5a58ab6dcb502d4889c4ccd5775c4/README.txt", | |
nullptr, received, error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment