drivers/windows/file_access_windows.cpp:312 - Condition "fwrite(p_src, 1, p_length, f) != (size_t)p_length" is true

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kufyweruk

How can I check what this error is? And how to fix it? And why does it arise?

drivers/windows/file_access_windows.cpp:312 - Condition “fwrite(p_src, 1, p_length, f) != (size_t)p_length” is true

Hi,
the error states that the length of the written data does not match the expected length.

Does the file even gets written?

klaas | 2020-08-26 21:28

:bust_in_silhouette: Reply From: BevanFindlay

I had this error when I’d accidentally tried writing to a file that was open in the wrong mode – i.e. I had two files open, one for reading (File.READ) and the other for writing (File.WRITE), but I had accidentally written the wrong name when trying to do store_line. It couldn’t write to a file that was opened for reading.