One way to do this is to have a fixedsize struct containing the data:
Code:
struct Person{
char *szName[64];
long *pin;
// + other data, fixed size
};
When you read the data from your (binary) file, read sizeof(Person) number of characters from the file, and typecast or memcopy the data to a Person:
Code:
Person pers;
memcpy(&pers, bufferfromfile, strlen(bufferfromfile));
//or
Person *pers = (Person*)bufferfromfile; // note! do not delete the allocated memory for bufferfromfile.
To create an array, store a header in the file that tells you how many records there is in the file. And it can tell you how big each record is, and where it is located in the file, but this would be optional. Now read in the header, and create a Person array the size you found out from the file. Remember that adding a record to the file must increase the count in the header. Another way is to use dynamic arrays aka std::vector, then you wont need the header for recordcounting. A thing I would use the header for though, is a kind of CRC check to see if the file is valid or corrupt, or changed manually since last time.
Remember that the file must be stored and read binary. When you write to the file, you typecast the Person struct to char* (void*??) and stream it to the file. This what you can strore an entire struct, and retreaving it by doing the process in reverse.