I am working on a project where I need to read data from a binary file. I am trying to store the data into a char buffer. Suppose the binary file consisted of a character, an int and a double what size would the char buffer need to be ? And how would I convert back into int's and doubles ?
I am reading the data into a char buffer because it would improve the speed of my program.
Thanks!
fwriteyou usefread. The speed issue is a red herring, it won't be noticeable if you do one or three calls tofread, specially sincefreadis reading from a buffer so in a way it already is in a "char buffer".freadis buffered, so it already extracts data from a "char buffer". My suggestion is that you try both ways and time it. If you really want to know the size of the data-types, usesizeof.