Help reading from a file in C - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help reading from a file in C

KotikKotik Posts: 7Member
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


Sign In or Register to comment.