1) Have one short int.
2) Have one float array.
3) Have a loop where a short int is read, converted to a float and placed inside the float array.
1) Have one short int.
2) Have one float array.
3) Have a loop where a short int is read, converted to a float and placed inside the float array.
In fact, 3 should be a simple assignment. Just store it directly into the float array.
Thanks for the replies
But these files are big. Reading an int at a time and making the assignment to the elements of a float array will take a lot more time than using fread to read the big block of data. Wont it?
Are you allowed to rewrite the file? Cause if reading it that way is a problem, then you should store floating point numbers in the file as well. Then you can just read them into memory at once.
If not, then what MacGyver suggested is as good as it's going to get it seems.