Системне програмне забезпечення, Детальна інформація
Системне програмне забезпечення
відображения стандартної панелі вибору файлу
if(DlgOpen.DoModal()==IDOK)
відкриття файлу і зчитування:
FILE *f = fopen(dlg.GetPathName(), "rt");
if (f == NULL)
{
AfxMessageBox("Can'topen file");
return;
}
int i;
char str[101], acBuf[1001];
acBuf[0] = '\0';
for (i = 0; i < 10; i++)
{
if (fgets(str, 100, f) == NULL)
break;
::lstrcat(acBuf, str);
}
MessageBox(acBuf, dlg.GetPathName(),
MB_ICONINFORMATION | MB_OK);
fclose(f);
}
Save
void CPashaWnd::OnFSaveAs()
{
char filter[] = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|";
CFileDialog dlg(FALSE, "*.txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter);
if (dlg.DoModal() == IDOK)
{
FILE *f = fopen(dlg.GetPathName(), "wt");
if(DlgOpen.DoModal()==IDOK)
відкриття файлу і зчитування:
FILE *f = fopen(dlg.GetPathName(), "rt");
if (f == NULL)
{
AfxMessageBox("Can'topen file");
return;
}
int i;
char str[101], acBuf[1001];
acBuf[0] = '\0';
for (i = 0; i < 10; i++)
{
if (fgets(str, 100, f) == NULL)
break;
::lstrcat(acBuf, str);
}
MessageBox(acBuf, dlg.GetPathName(),
MB_ICONINFORMATION | MB_OK);
fclose(f);
}
Save
void CPashaWnd::OnFSaveAs()
{
char filter[] = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|";
CFileDialog dlg(FALSE, "*.txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter);
if (dlg.DoModal() == IDOK)
{
FILE *f = fopen(dlg.GetPathName(), "wt");
The online video editor trusted by teams to make professional video in
minutes
© Referats, Inc · All rights reserved 2021