Code:
char *sFile=NULL,//pointer to be alloced mem
*pFile=NULL,//pointer to current pos in file
*pString=NULL,//pointer to current pos in new string
sText[64];//new string
CreateFile()//to open it
hMem=AllocMem(GetFileSize())//alloc for whole file
sFile=(char*)GlobalLock(hMem)//lock the mem
//file I/O is slow and risky on networked machines,
ReadFile(GetFileSize())//read whole file in one go to sFile
CloseFile()//leave open for as short time as poss
pFile=sFile;//set to begining of text file
while(pFile!='\0')
//extract string to add. I use commas in my text files as can be saved as Excel .csv
pString=sText;//set other pointer to string to fill in
while((*pFile != '\n')
&&(*pFile != '\r')
&&(*pFile != '\0')
&&(*pFile != ','))
*pString++ = *pFile++;
*pString='\0';
while(*pFile++ != ',');//skip the comma
iInt=atoi(pFile);//to get an int ect
while(*pFile++ != ',');//skip the comma
SetDlgItemText(GetWDlgItem(hDlg,ID_CTRL),sText)
//and on
FreeMem()