There's a bit of other checking before pFile is opened and load is a bool that is set if we're going to do more than just see if a file exists. If the file end is found before it should be, set values to defaultsįlightInfo.endFrameIndex = i - 1 if (load)įor ( i = 0 i < MAX_FLIGHT_ENTRIES i++)
Here's the code that reads from the file. I was hoping that reading the file would be just as easy, but it doesn't seem to be working, and I'm unable to debug it because I have a weird memory leak with Freetype in debug builds that prevents me from stepping into this code.
you can see the old fwrite is commented out now. if (fwrite (&FlightEntries, sizeof (FLIGHT_ENTRY_TYPE), 1, FPFPF) !=1) FPFPF = fopen( flightStr, "w+" ) įor ( i = 0 i < FlightInfo.endFrameIndex i++)įlightEntries.local_z += DeltaAlt I switched from using fwrite to using fprintf with a format specified ending with \n for new line.
The creation of the data files in ascii went without a hitch. I want to convert it to creating and reading human readable data files, which of course means I need to format the data and such. I'm converting a program that used to do a binary dump of a struct to file and read that binary struct back in using fread.