Enable use of command line options

This commit is contained in:
C-3PO 2018-09-14 00:48:53 +02:00
parent 313f65609f
commit 43614e1498
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
6 changed files with 137 additions and 20 deletions

View file

@ -19,6 +19,19 @@ void readBytesIntoBuffer(uint8_t* buffer, long numBytes) {
}
//Skips the given amount of bytes in the file
void skipBytes(long numBytes) {
const int result = fseek(file.filePointer, numBytes, SEEK_CUR);
if (result != 0) {
fprintf(stderr, "Could not skip %lu bytes from file: %s\n", numBytes, strerror(errno));
exit(1);
} else {
file.offset += numBytes;
}
}
//Closes the currently opened file and opens the next file at its beginning.
void openNextFile() {
const int closeResult = fclose(file.filePointer);

View file

@ -17,5 +17,9 @@ struct FILE_INFO file;
void readBytesIntoBuffer(uint8_t* buffer, long numBytes);
//Skips the given amount of bytes in the file
void skipBytes(long numBytes);
//Closes the currently opened file and opens the next file at its beginning.
void openNextFile();