FILE *pFile = fopen(fileDlg.GetFileName (),"r");
char array[1024];
memset(array,0,1024);
while(!feof(pFile))
{
fgets(array, 1024, pFile); //获取一行的信息
CString str;
str.Format ("%s",array);
int arr[5];
memset(arr,0, 5);
tradingname = filename;
int ipos = 0;
for (int i=0; i<5; i++)
{
ipos = str.Find (",", ipos+1);
arr[i] = ipos;
}
tradingday = str.Mid (0,arr[0]);
tradingday = TransForm(tradingday);
openprice = str.Mid (arr[0]+1,arr[1]-arr[0]-1);
highestprice = str.Mid (arr[1]+1, arr[2]-arr[1]-1);
lowestprice = str.Mid (arr[2]+1, arr[3]-arr[2]-1);
closeprice = str.Mid (arr[3]+1, arr[4]-arr[3]-1);
volume = str.Mid (arr[4]+1);
}
CString CDataMaintenanceDlg::TransForm(CString str)
{
CString strTemp, str1,str2,str3;
int arr[2];
memset(arr,0, 2);
int ipos = 0;
for (int i=0; i<2; i++)
{
ipos = str.Find ("/", ipos+1);
arr[i] = ipos;
}
str1 = str.Mid (0, arr[0]);
str2 = str.Mid (arr[0]+1, arr[1]-arr[0]-1);
str3 = str.Mid (arr[1]+1, arr[2]-arr[1]-1);
return strTemp=str3+str1+str2;
}