Read RememberNumber. Text file too little cBuff inside information, the data from multiple input some information to find how to deal with?
Void CDialog2: : OnBnClickedButton1 ()
{
The FILE * fp.
Char * p=NULL, * q=NULL, * pt=NULL, * pTemp=NULL;
CTemp char cBuf [1024]="", [128]=" ", cFlag [128]="";
Int I=0, j=0, iIndex=0, iRet;
Fp=fopen ("./RememberNumber. Text ", "r +");
If (fp & lt;=0)
{
AfxMessageBox (" do loading!" );
return ;
}
While (iRet=fread (cBuf g_ReadFileSizeof, 1, fp) & gt; 0)
{
The fflush (fp);
P=cBuf;
if (! P)
{
return;
}
Q=0;
Memset (cFlag, 0, sizeof (cFlag));
Memcpy (cFlag, g_Ctemp, strlen (g_Ctemp));
Q=STRSTR ((char *), p (const char *) cFlag);
If (q!=0)
{
MessageBox (cstrings cFlag, (cstrings) "information has been found!" );
IIndex++;
//modify the integral part of the
If (iRet=fseek (fp, (q - p) * 1 l, 1) & lt; 0)//move the file pointer to the member number
//if (iRet=fseek (fp, 10 l, SEEK_CUR) & lt; 0)
{
MessageBox ((cstrings) "file pointer offset failure 1!" );
return;
}
MessageBox ((cstrings) "file pointer 1!" );
Int k=0;
for (; K & lt; 8; K++)
{
Pt=STRSTR (p (char *), "\ t");
If (pt==NULL)
{
MessageBox ((cstrings) "unknown error!" );
return;
}
P=pt++;
}
If (iRet=fseek (fp, (p, q) * 1 l, 1) & lt; 0)
//if (iRet=fseek (fp, 10 l, SEEK_CUR) & lt; 0)
{
MessageBox ((cstrings) "file pointer offset failure 2!" );
return;
}
MessageBox ((cstrings) "file pointer 2!" );
The UpdateData (true);
//fwrite (" written content after offset!" , sizeof (" written content after offset!" ), 1, fp);
Fwrite (m_AadIntegral, strlen (m_AadIntegral) + 1, 1, fp);
//fprintf (fp, "% s \ r \ n", LogBuff);
fclose(fp);
The UpdateData (false);
return ;
}
}
AfxMessageBox ((cstrings) "information not found!" );
fclose(fp);
The UpdateData (false);
return ;
}