BUTTON代码键:
void CPDlg::OnConvert()
{
// TODO: Add your control notification handler code here
char buf[4096];
CString filename;
filename=m_edit;
CFile file;
file.Open(L"123.txt",CFile::modeReadWrite);
file.Read(buf,sizeof(buf));
file.Write(comment(buf),sizeof(comment(buf)));
file.Close();}COMMENT函数:
CString CPDlg::comment(char *buf)
{
int count=0;
int n,m;
CString str;
str=buf;
n=str.Find(L"//",0);
m=str.Find(L"/n",0);
str.Delete (n,m-n);
return(str);
}123.TXT 随便提供有"//"符号的几个字符串和前面没"//"的字符串不知道为什么好象FIND和DELETE函数没起到作用,请高手来个痛快点的.
void CPDlg::OnConvert()
{
// TODO: Add your control notification handler code here
char buf[4096];
CString filename;
filename=m_edit;
CFile file;
file.Open(L"123.txt",CFile::modeReadWrite);
file.Read(buf,sizeof(buf));
file.Write(comment(buf),sizeof(comment(buf)));
file.Close();}COMMENT函数:
CString CPDlg::comment(char *buf)
{
int count=0;
int n,m;
CString str;
str=buf;
n=str.Find(L"//",0);
m=str.Find(L"/n",0);
str.Delete (n,m-n);
return(str);
}123.TXT 随便提供有"//"符号的几个字符串和前面没"//"的字符串不知道为什么好象FIND和DELETE函数没起到作用,请高手来个痛快点的.
解决方案 »
- atl设计com的问题
- 小女子请教一个郁闷了很久的对话条的问题
- 文件操作错误
- 简单的问题,
- 什么是windows消息(WM_xxx)?举些例子好吗?
- 100分,我的VC重装了,结果自动完成功能出先这样的问题……来者有分!
- 问SQLPrepare怎么用啊 。什么意思?才鸟问题~~
- 救急编译老出错,f:\program files\microsoft visual studio\vc98\include\richedit.h(22) : warning C4518: 'extern ' : sto
- JI呀 !!! CMyDlg类中有一成员变量m_str(CString型),如何给使之能显示出"xxx"字符?
- MFC统计功能
- 请问驱动精灵的原理是什么?
- 内存泄漏,代码很少
m=str.Find(L"/n",0);
中
n=str.Find(L"//",0);
m=str.Find(L"/n",n);
这也不行
-----------------------------------IT者--IT开发者的网站 10万篇技术资料 天天更新
http://www.itzhe.cn
这里好像有问题,怎么看都只会写4个字节
还有"/n"是不是想写"\n"?
越看越像是把斜杠搞错了