Skip to content

Commit

Permalink
[DEBUG]
Browse files Browse the repository at this point in the history
  • Loading branch information
s-trinh committed May 7, 2024
1 parent 3362200 commit e8190ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/core/test/tools/io/testNPZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ int main(int argc, char *argv[])
std::vector<char> vec_save_string(save_string.begin(), save_string.end());
// Manually add a null-terminated character
// https://stackoverflow.com/a/8247804
vec_save_string.push_back('\0');
// vec_save_string.push_back('\0');
const std::string identifier = "String";
visp::cnpy::npz_save(npz_filename, identifier, &vec_save_string[0], { vec_save_string.size() }, "w");

visp::cnpy::npz_t npz_data = visp::cnpy::npz_load(npz_filename);
visp::cnpy::NpyArray arr_string_data = npz_data[identifier];
const std::string read_string = std::string(arr_string_data.data<char>());
std::vector<char> vec_arr_string_data = arr_string_data.as_vec<char>();
const std::string read_string = std::string(vec_arr_string_data.begin(), vec_arr_string_data.end());
std::cout << "(save_string == read_string)=" << (save_string == read_string) << std::endl;
}
{
Expand Down

0 comments on commit e8190ab

Please sign in to comment.