Structures, fread(), sizeof()
I am currently revising for a paper based C++ examination, which is tomorrow. I've come across a question which asks to write a program that will read data into a structure from an external file 'using a single statement'.
Would i be able to use fread() passing in the pointer to the structure, the size of the entire structure using sizeof() and passing in the pointer of the file to be read from - all in one statement.
or would i have to iterate through each element of the structure separately, the structure contains elements of different sizes in memory, eg. int - 4bytes and long - 8 bytes.
Any input would be great thanks