🎨 Improve error message
This commit is contained in:
parent
137d0c196e
commit
71894a9c4a
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue