📄 isodatadialog.cpp
字号:
// IsodataDialog.cpp : implementation file
//
#include "stdafx.h"
#include "200532590150.h"
#include "IsodataDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIsodataDialog dialog
CIsodataDialog::CIsodataDialog(CWnd* pParent /*=NULL*/)
: CDialog(CIsodataDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CIsodataDialog)
m_7=3;
m_8=2;
m_9=1;
m_10=3;
m_11=1;
m_12=4;
//}}AFX_DATA_INIT
}
void CIsodataDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CIsodataDialog)
DDX_Text(pDX, IDC_EDIT7, m_7);
DDX_Text(pDX, IDC_EDIT8, m_8);
DDX_Text(pDX, IDC_EDIT9, m_9);
DDX_Text(pDX, IDC_EDIT10, m_10);
DDX_Text(pDX, IDC_EDIT11, m_11);
DDX_Text(pDX, IDC_EDIT12, m_12);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CIsodataDialog, CDialog)
//{{AFX_MSG_MAP(CIsodataDialog)
ON_BN_CLICKED(IDC_READIN, OnReadin)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIsodataDialog message handlers
void CIsodataDialog::OnReadin()
{
// TODO: Add your control notification handler code here
CFileDialog dlg(TRUE);
UpdateData(TRUE);
if(dlg.DoModal()==IDOK)
{
CString m_FilePath=dlg.GetPathName();
CStdioFile File;
File.Open(m_FilePath,CFile::modeRead);//按输入路径读取文件
if(File==NULL)
MessageBox("文件为空!" ,MB_OK);//若文件为空则报错
CString FileData;
File.ReadString(FileData);
char temp1[10],temp2[10];//临时数组
memset(temp1,'\0',3);
sscanf(FileData,"%s",temp1);
count=atoi(temp1);
for(int i=0;i<count;i++)
{
//逐行读入数据
File.ReadString(FileData);
sscanf(FileData,"%s %s",temp1,temp2);
//将数据转换成为浮点型,并赋给相应数组元素
x1[i]=atof(temp1);
x2[i]=atof(temp2);
}
}
else
{
EndWaitCursor();
return;
}
UpdateData(FALSE);
}
void CIsodataDialog::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -