Sign in to follow this  

Quick problem

Recommended Posts

I just made a simple PAK file opener, but one line of code doesn't work... // Structures typedef struct { char Signature[4]; int DirOffset; int DirLength; int NumFiles; } pakHeader; typedef struct { char FileName[56]; int FilePosition; int FileLength; } pakEntry; // Open a PAK file FILE *file; pakHeader Header; pakEntry *Entry; int NumFiles; file = fopen(FileName, "rb"); fread(&Header, sizeof(Header), 1, file); if (strncmp(Header.Signature, "PACK", 4)) fclose(file); fread(&Header.DirOffset, sizeof(int), 1, file); fread(&Header.DirLength, sizeof(int), 1, file); NumFiles = Header.DirLength / sizeof(Header); // This line doesn't work and returns an error! Entry = new pakEntry(NumFiles); fseek(file, Header.DirOffset, SEEK_SET); fread(Entry, sizeof(pakEntry), NumFiles, file); for (int i = 0; i < NumFiles; i++) SendMessage(hListView, LB_ADDSTRING, 0, (LPARAM) Entry->FileName); If there are any other errors, please tell me them!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this