🎨 Improve error message

This commit is contained in:
C-3PO 2019-07-22 20:55:27 +02:00
parent 137d0c196e
commit 71894a9c4a
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -9,11 +9,11 @@
//Reads the given amount of bytes from the currently open file into the given buffer. //Reads the given amount of bytes from the currently open file into the given buffer.
void readBytesIntoBuffer(uint8_t* buffer, long numBytes) { void readBytesIntoBuffer(uint8_t* buffer, long numBytes) {
const size_t result = fread(buffer, 1, numBytes, file.filePointer); const unsigned long result = fread(buffer, 1, numBytes, file.filePointer);
file.offset += result; file.offset += result;
if (result != numBytes) { if (result != numBytes) {
fprintf(stderr, "Could not read %lu bytes from file: %s\n", numBytes, strerror(errno)); fprintf(stderr, "Wanted to read %lu bytes from file but only read %lu bytes: %s\n", numBytes, result, strerror(errno));
exit(1); exit(1);
} }
} }