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

📄 nxxxxx_killdoc.cpp

📁 自己写的一个数控加工程序中
💻 CPP
字号:
// Nxxxxx_killDoc.cpp : implementation of the CNxxxxx_killDoc class
//

#include "stdafx.h"
#include "Nxxxxx_kill.h"

#include "Nxxxxx_killDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CNxxxxx_killDoc

IMPLEMENT_DYNCREATE(CNxxxxx_killDoc, CDocument)

BEGIN_MESSAGE_MAP(CNxxxxx_killDoc, CDocument)
	//{{AFX_MSG_MAP(CNxxxxx_killDoc)
	
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNxxxxx_killDoc construction/destruction

CNxxxxx_killDoc::CNxxxxx_killDoc()
{
	// TODO: add one-time construction code here
	str_26A = _T("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	str_26a = _T("abcdefghijklmnopqrstuvwxyz");

}

CNxxxxx_killDoc::~CNxxxxx_killDoc()
{
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CNxxxxx_killDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CNxxxxx_killDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CNxxxxx_killDoc commands

BOOL CNxxxxx_killDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
	// TODO: Add your specialized creation code here
	str_filepath = lpszPathName;
	OnChange();
	return TRUE;
}


void CNxxxxx_killDoc::OnChange()
{
	FILE *file,*file2;
	if(!(file=fopen(str_filepath,"r"))){ 
		AfxMessageBox("不能打开指定文件!",MB_OK);
		exit(1);
	}
	//CString str2;
	str2.Empty();
	str2 = str2 + str_filepath + "0";
	if(!(file2=fopen(str2,"w+"))){ 
		AfxMessageBox("不能创建指定目标文件!",MB_OK);
		exit(1);
	}
	CString str;
	char ch[256];
	str = _T("");
	
	BeginWaitCursor();
	while(!feof(file)){
		
		fscanf(file,"%s",ch);
		str = str + ch;
	
		for(int i = 0;i < str.GetLength();i++){
			for(int j = 0;j<26;j++){
				//*
				if(str.GetAt(i) !='N'){
					if(str.GetAt(i) == str_26A.GetAt(j)){
					str.Delete(0,i);
					goto Loop;
					}
				}
				//*/
			}
		}
Loop:	
	
	fprintf(file2,"%s\n",str);
	str.Empty();
	str_filepath.Empty();
	}
	EndWaitCursor();
	
	fclose(file);
	fclose(file2);
	str2 = "N行号剔除已完成!\n保存路径为:\n" + str2;
	AfxMessageBox(str2,MB_OK);

}

⌨️ 快捷键说明

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