FileHandler.cpp
/**
 * Writes an array of numbers to the binary file
 * @param file The binary file to write to
 * @param arr The pointer of the integer array
 * @param page The number of the page to be written
 */
Writes an array of numbers to the binary file
@param file The binary file to write to
@param arr The pointer of the integer array
@param page The number of the page to be written
Writes an array of numbers to the binary file @param file The binary file to write to @param arr The pointer of the integer array @param page The number of the page to be written
void FileHandler::writeNumbers(std::FILE* file, int* arr, int page) {
    if (page == -1)
        return;
    int arrSize = 256;
    std::fseek(file, sizeof(int) * page * arrSize, SEEK_SET);
    for (int i = 0; i < arrSize; ++i) {
        if (arr[i] == -1)
            continue;
        std::fwrite(&arr[i], sizeof(int), 1, file);
    }
}
void FileHandler :: writeNumbers ( std :: FILE * file , int * arr , int page ) { if ( page == -1 ) return ; int arrSize = 256 ; std :: fseek ( file , sizeof ( int ) * page * arrSize , SEEK_SET ) ; for ( int i = 0 ; i < arrSize ; ++ i ) { if ( arr [ i ] == -1 ) continue ; std :: fwrite ( & arr [ i ] , sizeof ( int ) , 1 , file ) ; } }
Writes an array of numbers to the binary file
 @param file The binary file to write to
 @param arr The pointer of the integer array
 @param page The number of the page to be written
Writes an array of numbers to the binary file @param file The binary file to write to @param arr The pointer of the integer array @param page The number of the page to be written
//printf("Will save page %d\n", page); //printf("The arrsize is %d\n", arrSize); //cout << arr[i] << endl;