Create a struc to hold the data.
Open the file, find the size with GetFileSize().
GlobalAlloc() for the whole file and read the whole file in one read to the buffer. Close the file.
Alloc for the first record (sizeof(STRUCT))
Copy into a temp record.
Code:
STRUCT TempRecord,*RecordArray=NULL;
char *pStart=NULL,*pString=NULL;
int iRecordsRead=0;
HGLOBAL hMemHandle=NULL;
pStart=sFile;//set to the start of the buffer
while(*pStart!='\0')
{
TempRecord.iNumber=atoi(pStart);
while(*pStart++ != ';');//move thru the ;
pString=TempRecord.sDescription;
while((*pStart != '\n')&&(*pStart !='\r')&&(*pStart != '\0')&&(*pStart != ';'))
*pString++ = *pStart++;
*pString='\0';
while(*pStart++ != ';');
//ect I think you get the idea
while((*pStart == '\n')||(*pStart == '\r'))
pStart++;//move past the end of line
CopyMemory(&(RecordArray[iRecordsRead]),&TempRecord,sizeof(STRUCT));
iRecordsRead++;
hMemHandle=GlobalHandle(RecordArray);
hMemHandle=GlobalReAlloc(hMemHandle,( sizeof(STRUCT) * (iRecordsRead+1)), GMEM_MOVEABLE);
//error check for mem alloc fail if(hMemHandle==NULL)
}
Free the files buffer with GlobalFree() and GlobalHandle() if needed.