Change example for strs, not working for the moment !

This commit is contained in:
Ulysse Cura 2025-08-06 16:09:16 +02:00
parent 103a0317ec
commit 4c2a164b4a
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#include "bin.hpp"
void load_json_into_bin(json *json_input, Bin *bin_output)
-void load_json_into_bin(json *json_input, Bin *bin_output)----
{
bin_output->value1 = (*json_input)["value1"].get<uint8_t>();
bin_output->value2 = (*json_input)["value2"].get<uint8_t>();
bin_output->value = (*json_input)["value"].get<uint8_t>();
bin_output->str = (*json_input)["str"].get<std::string>().c_str();
}

View File

@ -6,8 +6,8 @@
using nlohmann::json;
struct Bin {
uint8_t value1;
uint8_t value2;
uint8_t value;
const char *str;
};
void load_json_into_bin(json *json_input, Bin *bin_output);

View File

@ -1,4 +1,4 @@
{
"value1": 10,
"value2": 42
"value": 10,
"str": "ABC"
}