48 HANDLE data_file_handle = ::CreateFile(file_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
52 int data_file_descriptor = _open_osfhandle((
intptr_t)data_file_handle, 0);
53 if (-1 == data_file_descriptor)
55 ::CloseHandle(data_file_handle);
59 const std::unique_ptr<FILE, tools::close_file> data_file_file{_fdopen(data_file_descriptor,
"wb")};
60 if (
nullptr == data_file_file)
63 _close(data_file_descriptor);
68 std::ofstream data_file(data_file_file.get());
75 std::ofstream data_file;
76 data_file.open(file_path , std::ios_base::binary | std::ios_base::out| std::ios::trunc);
89 ::FlushFileBuffers(data_file_handle);
93 CATCH_ENTRY_L0(
"serialize_obj_to_file",
false);