Example #1
0
int _tmain(int argc, _TCHAR* argv[])
{
	char a = 't';
	RandomAccessFile* rf = new RandomAccessFile("tst.bin");
	rf->write(a);
	RandomAccessFile* rf2 = new RandomAccessFile("tst.bin");
	cout << rf2->read<char>(0) << endl;
}
Example #2
0
    // Write all the records to the file.
    // The payload is pseudo-randomly generated.
    void writeRecords (RandomAccessFile& file,
                       int numRecords,
                       HeapBlock <Record> const& records,
                       std::int64_t seedValue)
    {
        using namespace UnitTestUtilities;

        for (int i = 0; i < numRecords; ++i)
        {
            Payload p (records [i].bytes);

            p.repeatableRandomFill (records [i].bytes,
                                    records [i].bytes,
                                    records [i].index + seedValue);

            file.setPosition (records [i].offset);

            Result result = file.write (p.data.getData (), p.bytes);

            expect (result.wasOk (), "Should be ok");
        }
    }