I'm trying to write a C program that takes 3 different inputs from the user (name, day, year) and then I fwrite it into a binary file in the following format "Name | day | year". Nothing complicated so far, its just "%s | %s | %s".
However I also want the user to be able to access information from the said binary file. I,e the user can get a list of all the names. How would I go about so that the program reads the binary file and reads the "Name | day | year" and stores each of the elements into an array. (I want it to be an array so I can sort the names alphabetically (but that is another issue).
Writing into the file seems relatively straight forward but I have no idea how to read from the file with the " | " dividing each parameter.
Thanks in advance
0 · ·