I have a list of data which can be Integers, Floats, string or even chars etc that needs to be written into a .bin Binary file in binary format. Besides being able to write into the bin file, I need to be able to read from it too. However I need to be able to read and write from the bin file content non sequentially. An example of the file content is as below (the text below the bits are what it represent after retrieval): 011001 011000 00111001 101110001
Her name is MarySuppose I want to retrieve the name of the person. Instead of traversing from "Her" -> "name" -> "is" -> "Mary" to get my result, I need to be able to jump straight and get the binary representation of Mary and return the results.
Has anyone done something similar and is able to provide me with some insight to get a head start.
Mary starts 13 characters in. If you use a random access file you can access any character if you know its position. You can't replace Mary with Susan unless you had previously allow for a larger field and left empty space. A true binary file would usually need a fixed number of bits per character (usually 8).
I think you need to study data structures.
| « C++ combination program p... | [Solved] Jump to random sections » |