本文整理汇总了C++中CFileWriter::WriteBuf方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileWriter::WriteBuf方法的具体用法?C++ CFileWriter::WriteBuf怎么用?C++ CFileWriter::WriteBuf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileWriter
的用法示例。
在下文中一共展示了CFileWriter::WriteBuf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnButton
void CShowOneDescriptionDlg::OnButton(wxCommandEvent& event)
{
if (event.GetId()==wxID_OK)
{
int err;
wxString CurrentDir = wxGetCwd();
if (!m_descr)
return;
wxFileDialog dialog(GetParent(),
wxT("Save current text"),
wxT(""),
wxT(""),
wxT(SZ_ALL_FILES),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
err = dialog.ShowModal();
wxSetWorkingDirectory(CurrentDir);
if (wxID_OK == err)
{
CFileWriter F;
if (F.Open(dialog.GetPath().mb_str()))
{
F.WriteBuf(m_descr, strlen(m_descr));
F.Close();
}
else
wxMessageBox(wxT("Can not open file"));
}
}
else if (event.GetId()==wxID_CANCEL)
{
StoreSize();
EndModal(wxID_CANCEL);
}
}
示例2: SaveAs
void CShowDescriptionListDlg::SaveAs()
{
int err, i;
CBaseObject * pObj;
CStr S(128);
wxString CurrentDir = wxGetCwd();
wxFileDialog dialog(GetParent(),
wxT("Save current text"),
wxT(""),
wxT(""),
wxT(SZ_ALL_FILES),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
err = dialog.ShowModal();
wxSetWorkingDirectory(CurrentDir);
if (wxID_OK == err)
{
CFileWriter F;
if (F.Open(dialog.GetPath().mb_str()))
{
for (i=0; i<m_pItems->Count(); i++)
{
pObj = (CBaseObject*)m_pItems->At(i);
S = pObj->Description;
S.TrimRight(TRIM_ALL);
S << EOL_FILE;
F.WriteBuf(S.GetData(), S.GetLength());
}
F.Close();
}
else
wxMessageBox(wxT("Can not open file"));
}
}