KaviKumar N
KaviKumar N

Reputation: 35

write output to json from c++ webassembly code using emscripten

  1. I would like to write my program output i.e., "some-key:some-value" to JSON file while running my web assembly c++ code through Emscripten. I found a way to read the data from JSON file through the same way, As described here.
  2. Is there any possibility to update the data in browser view which dynamically changes every second?

Upvotes: 0

Views: 1854

Answers (1)

sbc100
sbc100

Reputation: 3022

  1. It looks like the json library you reference supported writing json: https://github.com/nlohmann/json. There are examples of using the .dumps() method to output json.

  2. I assume you want to update the DOM based on code running WebAssembly? The only want to effect the DOM from WebAssembly is call out to JS, or have JS call into wasm. For example you could have a setTimeout in JS that calls a WebAssembly function every second to retrieve some new state, and then use that to update the DOM.

Upvotes: 1

Related Questions