After about two or more hours of experimenting and going crazy trying to find an answer, I've decided to bring the problem here, where there are many people that know what they're doing.
I'm writing a C program to open a file and read bytes on each line, formatting them along the way.
That is generally what I have so far (I'm not including the loops and some other things as to not take up too much space).Code:#include <stdio.h> int main() { FILE *modeldata1, *modeldata2; char modeldata1choice[30],modeldata2choice[30]; printf("Model to convert: "); gets(modeldata1choice); printf("Save converted file as: "); gets(modeldata2choice); }
> One loop operates on the file-size of "modeldata1." How could I get the total size of the file in hex bytes?
> The other loop will need to read two bytes at a time into their corresponding variables.
float xcoord,ycoord,zcoord;
XX XX YY YY ZZ ZZ
I've tried fgets and fgetc, but they don't seem to be working out. The fgets function will read two bytes for me, but it reads them in a string format that shows the wrong values when in hex.
Hopefully I didn't make this very confusing.