Hi!
Please correct the below code:
file already contains entries : 1st row username; 2nd row password.
check status required to write at third line and need to read or alter the check status value.
Currently this code is working if already there is a value for check status, then it is overwriting else UI hanging.
Code:WriteCheckStatusToFile(BOOL& locVar) { FILE *l_pFile = NULL; CString l_strRememberCheck; l_strRememberCheck = GetExePath() + _T("password"); CString sVar; sVar.Format(_T("%d"),locVar); if(NULL != (l_pFile = fopen(l_strRememberCheck, _T("r+"))) ) { int count = 0; char c; while(count != 2) { if((c = fgetc(l_pFile)) == '\n') count++; } fseek(l_pFile,ftell(l_pFile),SEEK_SET); fprintf(l_pFile, sVar); } l_strRememberCheck.ReleaseBuffer(); fclose(l_pFile); }
thanks in advance to all!
sam.


Reply With Quote

Bookmarks