16,471
社区成员
发帖
与我相关
我的任务
分享
unsigned char* template;
int template_length;
CString DataStyle=_T("data(*.dat)|*.dat||");
CFileDialog dlg(TRUE,NULL,FALSE,NULL,DataStyle,NULL);
(dlg.m_ofn).lpstrTitle="open data";
if (dlg.DoModal()==IDOK)
{
dlg.CenterWindow();
CString m_strdataPath=dlg.GetPathName();
FILE*fp;
int i=0;
fp=fopen(m_strdataPath,"r");
if (fp==NULL)
{
AfxMessageBox(_T("Load data failed!"));
}
fscanf( fp, _T("%d\n"), &template_length);
template=new unsigned char[template_length];
while(!feof(fp))
{
fscanf( fp, _T("%d "), &template[i]);
i++;
}
delete[] template;
}
unsigned char test[8] = { 0 };
::_stscanf(_T("123456789"), _T("%d"), &test[3]);