I followed the Webassembly getting started tutorial http://webassembly.org/getting-started/developers-guide/
It worked fine and displayed the \"Hello, world!\" messa
You can package files or directories into the WASM virtual file system using the --embed-file flag.
--embed-file
In your case this would look like:
emcc pfile.cpp -s WASM=1 -o pfile.html -v --embed-file test.txt
Docs: https://kripken.github.io/emscripten-site/docs/porting/files/packaging_files.html