|
IniInfor Ini[2] = {0};
BOOL CReadIniDlg::ReadIniFile()
{
UpdateData();
FILE* fp = NULL;
char SystemPath[MAX_PATH] = {0};
GetSystemDirectory( SystemPath, MAX_PATH );
int len = strlen(SystemPath)-1;
if (SystemPath[len] != '\\')
strcat(SystemPath,"\\");
strcat(SystemPath,INIFILE);
fp = fopen (SystemPath, "r" );
if (fp == NULL)
{
return FALSE;
}
fread(&Ini[0], sizeof(Ini), 1, fp);//Read the file and store it in the Ini array, the size is sizeof(Ini)
fclose(fp);//Close the file
m_Edit2.SetWindowText((char*)&Ini[1]);
m_Edit2.SetWindowText((char*)&fp); //Why is the garbled text read here?
UpdateData(false);
return TRUE;
} |
|