Computer Science Canada

Inventory System using Binary Files

Author:  Paul [ Wed Nov 16, 2005 9:44 pm ]
Post subject:  Inventory System using Binary Files

Instead of the normal text file where you can use sequential access to read/write information. This is using a binary file, in small scales there's really not alot of difference. But in large scales, I suppose there will be.

For example:
you have
123
1234
12345
12
1234

in a normal file, to get to the last "12" you would have to read through everything above it.

Using a binary file, you can just "seek" to that specific location, provided you know how many bytes the data before it takes up. And that I have done using an array of records, in which the fields have specific size allocations.

Anyhow, 3 files below:
inventory.t - the actual inventory system program
CreateDataFile.t - used to create the binary file
inventorydata.txt - the binary file


: