#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
#include "FixedLen_1.h"
void WriteFile( fstream& infile, char rrn[ ], int number, int length ) {
fstream outfile;
char buffer[MaxStr];
outfile.open( "temp.txt", fstream::out );
outfile << FixedLen( number, buffer, 6 );
outfile << FixedLen( length, buffer, 5 ) << '\n';
for ( int i = 0; i < number; i++ ) {
infile.seekg ( 12+rrn[i]*length, fstream::beg );
infile.read ( buffer, length );
outfile.write( buffer, length );
}
system( "mv temp.txt books.txt" );
outfile.close( );
}
|
|
|
|