reading a file of this type
hey people, im having a really big problem with this, ive tried alsorts but im not very good at C
I have a file that was writen in this format, i can open it with notpad but its a bit unreadable!
here is how the file is made up!
First, 8 bytes of header:
Code:
struct TrackRecordHeader
{
unsigned int version; // version == 0x0000000a
unsigned int trackRecordCount; // Number of track records stored in file
};
Then all the track records follow in succession. Here's how one track record looks:
Code:
struct TrackRecordEntry
{
unsigned int playerNameLength; // Number of bytes in player name
wchar playerName[??]; // Name of player, 2 bytes per character (wide-character format)
unsigned int carNameLength; // Number of bytes in car name
char carName[??]; // Name of car, 1 byte per character
FILETIME dateTime; // Date & time when record was made, see <windows/wtypes.h>
float time; // Record time, measured in seconds
};
The FILETIME structure is defined in the standard Windows SDK. A look in MSDN yields the following information:
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.
Code:
typedef struct _FILETIME { // ft
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
... so you should be able to manipulate the FILETIME structure with standard Win32 API calls.
Then all the checkpoint records follow, as a linear stream of floats:
Code:
unsigned int numberOfCheckpointTimes; // Number of checkpoint times that follow
float checkpointTimes[??]; // All the checkpoint times, measured in seconds
could anybody help on how i would open this file and view it in a normal text or ascii!
Thanks guys!