⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readtxtdoc.cpp

📁 根据空间三点坐标来计算三点所在圆心,可以应用到测量领域
💻 CPP
字号:
// ReadTxtDoc.cpp : implementation of the CReadTxtDoc class
//

#include "stdafx.h"
#include "ReadTxt.h"

#include "ReadTxtDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CReadTxtDoc

IMPLEMENT_DYNCREATE(CReadTxtDoc, CDocument)

BEGIN_MESSAGE_MAP(CReadTxtDoc, CDocument)
	//{{AFX_MSG_MAP(CReadTxtDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReadTxtDoc construction/destruction

CReadTxtDoc::CReadTxtDoc()
{
	// TODO: add one-time construction code here
	n=0;
}

CReadTxtDoc::~CReadTxtDoc()
{
}

BOOL CReadTxtDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CReadTxtDoc serialization

void CReadTxtDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CReadTxtDoc diagnostics

#ifdef _DEBUG
void CReadTxtDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CReadTxtDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CReadTxtDoc commands

BOOL CReadTxtDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	// TODO: Add your specialized creation code here
	CString str;
	char* ch;
	CStdioFile file(lpszPathName,CFile::modeRead);
	while(file.ReadString(str)!=FALSE)
	{
		n++;
	}
	file.Close();
	CStdioFile file2(lpszPathName,CFile::modeRead);
	a = new double[3*n];
	int i=0;
	while(file2.ReadString(str)!=FALSE)
	{
		ch=(char *)str.GetBuffer(0);
		a[i++]=atof(strtok(ch,","));
		a[i++]=atof(strtok(NULL,","));
		a[i++]=atof(strtok(NULL,","));
	}
	
	file2.Close();
	return TRUE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -