当前位置: 首页>>代码示例>>C++>>正文


C++ CFileException::ReportError方法代码示例

本文整理汇总了C++中CFileException::ReportError方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileException::ReportError方法的具体用法?C++ CFileException::ReportError怎么用?C++ CFileException::ReportError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileException的用法示例。


在下文中一共展示了CFileException::ReportError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnBnClickedLoadbtn

void CTextPadDlg::OnBnClickedLoadbtn()
{
	// TODO: Add your control notification handler code here
	char szFilter[] = "(*.txt) | All Files(*.*)|*.*||";
	CFileDialog dlg(TRUE, "txt", "*.txt", OFN_HIDEREADONLY, szFilter);
	if(IDOK == dlg.DoModal()){
		CString strPathName = dlg.GetPathName();
		
		CStdioFile fp;
		CFileException e;
		
		if(!fp.Open(strPathName, CFile::modeRead, &e)) {
			e.ReportError();
			return;
		}

		CString str = "";
		CString tmp = "";
		
		while(fp.ReadString(tmp)){
			str += tmp;
			str += "\r\n";
		}
		UpdateData(FALSE);
		textpad.SetWindowText(str);
		fp.Close();
	}
}
开发者ID:Sanghyun-Lee,项目名称:MyProject,代码行数:28,代码来源:TextPadDlg.cpp

示例2: OnBnClickedSavebtn

void CTextPadDlg::OnBnClickedSavebtn()
{
	// TODO: Add your control notification handler code here
	//CFileDialog를 숨긴파일 읽지않고, 
	//같은 이름의 파일이 있을시 물어보는 옵션으로 열기
	char szFilter[] = "(*.txt) | All Files(*.*)|*.*||";
	CFileDialog dlg(FALSE, "txt", "*.txt",
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT  , szFilter);
	
	if(IDOK == dlg.DoModal()){
		CString strPathName = dlg.GetPathName();

		CStdioFile fp;
		CFileException e;
		
		if(!fp.Open(strPathName,CFile::modeWrite|CFile::modeCreate, &e)) {
			e.ReportError();
			return;
		}

		UpdateData(TRUE);
		CString str;
		textpad.GetWindowText(str);
		str.Replace("\r\n", "\n");

		fp.WriteString(str);
		fp.Close();
	}
}
开发者ID:Sanghyun-Lee,项目名称:MyProject,代码行数:29,代码来源:TextPadDlg.cpp

示例3: convert_all_file

void CKmlDlg::convert_all_file()
{
	int i;
	CString temp;
	for(i=0;i<NumOfFile;i++)
	{
		CFileException ef;
		try
		{		        
			if(!Fsource.Open(FilePath[i],CFile::modeRead,&ef))
			{
				ef.ReportError();
				continue;
			}
			IsFSourceOpen = true;

			kml_filename = FileName[i];
			int find = kml_filename.Find(".");
			kml_filename = kml_filename.Mid(0,find);   

			Convert();
			
			temp.Format("%s OK",FileName[i]);
			m_check[i].SetWindowText(temp);
			m_check[i].SetCheck(BST_CHECKED);	
		}
		catch(CFileException *fe)
		{
			fe->ReportError();
			fe->Delete();
		}	
	}
}
开发者ID:asion0,项目名称:AsionGitCodes,代码行数:33,代码来源:KmlDlg.cpp

示例4: Save

bool CCrossDlg::Save(int Sel)
{
	ASSERT(Sel >= 0 && Sel < SELS);
	CPathStr	FileName;
	GetName(Sel, FileName);
	CFileDialog	fd(FALSE, EXT_PATCH, FileName, OFN_OVERWRITEPROMPT, LDS(IDS_FILTER_PATCH));
	if (fd.DoModal() != IDOK)
		return(FALSE);
	CStdioFile	fp;
	CFileException	e;
	if (!fp.Open(fd.GetPathName(), CFile::modeCreate | CFile::modeWrite, &e)) {
		e.ReportError();
		return(FALSE);
	}
	CPatch	Patch;
	Patch = m_Info[Sel];	// assign parm info
	m_Frm->GetPatch(Patch);	// get master and main info
	if (!Patch.Write(fp))
		return(FALSE);
	m_Modified[Sel] = FALSE;
	FileName = fd.GetFileName();
	FileName.RemoveExtension();
	SetName(Sel, FileName);
	return(TRUE);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:25,代码来源:CrossDlg.cpp

示例5: DoIO

bool CJobList::DoIO(LPCTSTR Path, DWORD FileMode, DWORD ArchiveMode)
{
	CFile	fp;
	CFileException	e;
	if (!fp.Open(Path, FileMode, &e)) {
		e.ReportError();
		return(FALSE);
	}
	TRY {
		CArchive	ar(&fp, ArchiveMode);
		ar.m_strFileName = fp.GetFileName();
		Serialize(ar);
	}
	CATCH(CArchiveException, e)
	{
		e->ReportError();
		return(FALSE);
	}
开发者ID:victimofleisure,项目名称:FFRend,代码行数:18,代码来源:JobList.cpp

示例6: Read

bool CPatch::Read(LPCTSTR Path)
{
	CStdioFile	fp;
	CFileException	e;
	if (!fp.Open(Path, CFile::modeRead | CFile::shareDenyWrite, &e)) {
		e.ReportError();
		return(FALSE);
	}
	TRY {
		if (!Read(fp)) {
			AfxMessageBox(IDS_DOC_BAD_FORMAT);
			return(FALSE);
		}
	}
	CATCH(CFileException, e)
	{
		e->ReportError();
		return(FALSE);
	}
开发者ID:Dewb,项目名称:UltraWhorld,代码行数:19,代码来源:Patch.cpp

示例7: convert_all_file

void CKmlDlg::convert_all_file()
{
	int i;
	CString temp;
	CKmlDlg::kmlDlg->PostMessage(UWM_PROGRESS, 1, 0);	//Show progress
	for(i = 0; i < NumOfFile; ++i)
	{
		CFileException ef;
		CFile f;
		try
		{
      if(KML_USE_CHECKLISTBOX)
      {
        m_fileList.SetCurSel(i);
      }

			if(!f.Open(FilePath[i], CFile::modeRead,&ef))
			{
				ef.ReportError();
				continue;
			}

			kml_filename = FilePath[i];
			int find = kml_filename.ReverseFind('.');
			kml_filename = kml_filename.Mid(0,find);   

			//Convert(f);
			Convert2(f);
			f.Close();

			temp.Format("%s OK", FileName[i]);
      if(KML_USE_CHECKLISTBOX)
      {
        //m_fileList.SetCurSel(i);
        m_fileList.DeleteString(i);
        m_fileList.InsertString(i, temp);
        m_fileList.SetCheck(i, BST_CHECKED);
      }
      else
      {
			  m_check[i].SetWindowText(temp);
			  m_check[i].SetCheck(BST_CHECKED);	
      }
		}
		catch(CFileException *fe)
		{
			fe->ReportError();
			fe->Delete();
		}	
	}
	CKmlDlg::kmlDlg->PostMessage(UWM_PROGRESS, 0, 1000);	//Hide progress
}
开发者ID:asion0,项目名称:GNSS_Viewer_V2,代码行数:52,代码来源:KmlDlg.cpp

示例8: Open

BOOL Driver::Open(LPCTSTR filename,CStdioFile &File,UINT nOpenFlags)
{
	CFileException ex;
    if (!File.Open(filename,nOpenFlags))
    {
        ex.ReportError();
        return FALSE;
    }
	else
	{
		return TRUE;
	}
}
开发者ID:uesoft,项目名称:AutoPFA,代码行数:13,代码来源:Driver.cpp

示例9: Open

//************************************
// Method:    Open
// FullName:  CRawFileExporter::Open
// Access:    public 
// Returns:   int
// Qualifier:
// Parameter: CString in_szFilePath
//************************************
int CRawFileExporter::Open( CString in_szFilePath )
{
	int ret = SV_NORMAL;
	m_szFilePath = in_szFilePath;
	CFileException ex;
	BOOL bflagOpen = m_oFile.Open(m_szFilePath, CFile::modeWrite | CFile::modeCreate, &ex);
	if(!bflagOpen)
	{
		ret = SV_FILEIO_ERROR;
		ex.ReportError();
		m_szFilePath = _T("");
	}

	return ret;
}
开发者ID:phamquy,项目名称:SliceView,代码行数:23,代码来源:RawFileExporter.cpp

示例10: Load

BOOL CImportFile::Load(const TCHAR *filename)
{
	ASSERT( m_pDesign == NULL );

	CFile f;
	CFileException e;
	if( !f.Open( filename, CFile::modeRead, &e ) ) 
	{
		e.ReportError();
		return FALSE;
	}
	CArchive ar( &f, CArchive::load );
	m_pDesign = new CTinyCadMultiDoc;
	m_pDesign->Serialize( ar );

	return TRUE;
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:17,代码来源:NetList.cpp

示例11: DumpResourceToFile

BOOL helper::DumpResourceToFile(LPCSTR lpName, LPCSTR lpType, LPCSTR lpFile)
{
	HRSRC hrsRC = ::FindResource(NULL, lpName, lpType);
	HGLOBAL hGlobal = ::LoadResource(NULL, hrsRC);
	LPVOID pData = ::LockResource(hGlobal);
	DWORD dwLen = ::SizeofResource(NULL, hrsRC);
	
	CFile f;
	CFileException e;
	if (!f.Open(lpFile, CFile::modeCreate | CFile::modeWrite, &e))
	{
		e.ReportError();
		return FALSE;
	}

	f.Write(pData, dwLen);
	f.Close();

	return TRUE;
}
开发者ID:timepp,项目名称:superword,代码行数:20,代码来源:Helper.cpp

示例12: Load

/**
 * Load the coding file
 */
void CCoding::Load()
{
    Clear();
    CFileFind finder;
    if (finder.FindFile(m_Filename)) {
        finder.Close();
    } else {
        if (!SaveRes(m_Filename)) {
            ShowError(_T("Can't find encoding file \"") + m_Filename + _T("\""));
            return;
        }
    }

    CFileException ex;
    CFile f;
    if (f.Open(m_Filename, CFile::modeRead | CFile::shareDenyWrite, &ex)) {
        char c;
        CString line;
        while (f.Read(&c, 1)) {
            switch (c) {
            case 10:
                break;
            case 13:
                if (!line.IsEmpty()) {
                    AddCode(line);
                    line.Empty();
                }
                break;
            default:
                line += c;
            }
        }
        f.Close();
        if (!line.IsEmpty()) {
            AddCode(line);
        }
    } else
        ex.ReportError();

    m_Loaded = TRUE;
}
开发者ID:stievie,项目名称:bibedt,代码行数:44,代码来源:Coding.cpp

示例13: OnBvecButton

void ToolWnd::OnBvecButton()
{
	CMainFrame * pFrame = (CMainFrame *) AfxGetApp()->m_pMainWnd;

	CString szFilter = _T("B-vector table (*.txt)|*.txt| All Files (*.*)|*.*|");

	CFileDialog dlg (TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT, szFilter, this);

	if(dlg.DoModal() == IDCANCEL)
		return;

	CStdioFile		file;
	CFileException	e;
	CString			str, temp;
	int				i = 0;
	
	if(!file.Open(dlg.GetPathName() , CFile::modeRead, &e))
	{
		e.ReportError();
		return;
	}
	
	for (int i =0; i <3; i++)
	{
		for(int j =0; j <15; j++)
		{
			if(file.ReadString(str))
			{
				AfxExtractSubString(temp,str, 0,'\n');
				BV[i][j] =_ttof(temp);
			}
		}
	}

	file.Close();

	AfxMessageBox(_T("Complete Load B-vec"));
}
开发者ID:MHLee04,项目名称:MHLEE,代码行数:38,代码来源:ToolWnd.cpp

示例14: Open

bool CCrossDlg::Open(int Sel, LPCTSTR Path)
{
	ASSERT(Sel >= 0 && Sel < SELS);
	if (!SaveCheck(Sel))
		return(FALSE);
	CStdioFile	fp;
	CFileException	e;
	if (!fp.Open(Path, CFile::modeRead | CFile::shareDenyWrite, &e)) {
		e.ReportError();
		return(FALSE);
	}
	CPatch	Patch;
	if (!Patch.Read(fp))
		return(FALSE);
	m_Info[Sel] = Patch;
	UpdateMix(m_PosEdit.GetVal());
	CPathStr	FileName(PathFindFileName(Path));
	FileName.RemoveExtension();
	SetName(Sel, FileName);
	if (Sel == m_Frm->GetEditSel())	// if input is selected for editing
		m_Frm->SetEditSel(Sel);	// refresh parameters dialog
	return(TRUE);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:23,代码来源:CrossDlg.cpp

示例15: OnBnClickedOk

void CGetEphemerisDlg::OnBnClickedOk()
{
	m_file.GetWindowText(m_fileName);

	if(m_fileName.IsEmpty())
	{
		AfxMessageBox("Please create a new file to save Ephemeris data!");
		return;
	}

	if(Utility::IsFileExist(m_fileName))
	{
		AfxMessageBox("File already exist!");
		return;
	}

	CFileException ef;
	try
	{				
		if(!CGPSDlg::gpsDlg->m_ephmsFile.Open(m_fileName, CFile::modeReadWrite|CFile::modeCreate, &ef))
		{
			//CGPSDlg::gpsDlg->m_ephmsFile.Close();
			ef.ReportError();
			return;
		}		
	}
	catch(CFileException *fe)
	{
		fe->ReportError();
		fe->Delete();
		return;
	}		
	g_SV = m_ephems.GetCurSel(); 
	AfxBeginThread(GetEphmsThread, (void*)ephType);
	OnOK();
}
开发者ID:asion0,项目名称:GNSS_Viewer_V2,代码行数:36,代码来源:Ephems.cpp


注:本文中的CFileException::ReportError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。