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

📄 subject_36632.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:36632 发表者:苦闷 发表日期:2003-04-17 11:35:31
<br>主题:简单问题
<br>内容:假如我对话框上有二个编辑控件,相应的变量为CString m_Edit1,m_Edit2,ccc.txt有二个数目5000 20中间有一个空格,我现在想把5000赋值给m_Edit1,20赋值给m_Edit2.<BR>BOOL CTestDlg::OnInitDialog()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;char * aa;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFile file;<BR>&nbsp;&nbsp;&nbsp;&nbsp;file.Open("ccc.txt",CFile::modeRead);<BR>&nbsp;&nbsp;&nbsp;&nbsp;aa=new char[file.GetLength()];<BR>&nbsp;&nbsp;&nbsp;&nbsp;file.Read(aa,file.GetLength());<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(unsigned int i=0;i&lt;strlen(aa);i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这里怎么写代码。<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;&nbsp;&nbsp;<BR>}
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:龙人 回复日期:2003-04-17 12:32:31
<br>内容:&nbsp;&nbsp;&nbsp;&nbsp;char * aa;<BR>&nbsp;&nbsp;&nbsp;&nbsp;CFile file;<BR>&nbsp;&nbsp;&nbsp;&nbsp;int nIndex;<BR>&nbsp;&nbsp;&nbsp;&nbsp;file.Open("ccc.txt",CFile::modeRead);<BR>&nbsp;&nbsp;&nbsp;&nbsp;aa=new char[file.GetLength()];<BR>&nbsp;&nbsp;&nbsp;&nbsp;file.Read(aa,file.GetLength());<BR>&nbsp;&nbsp;&nbsp;&nbsp;CString strContext(aa);<BR>&nbsp;&nbsp;&nbsp;&nbsp;nIndex = strContext.Find(' ',0);//找到空格的位置<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Edit1 = strContext.Left(nIndex);//截取空格左边的字符串<BR>&nbsp;&nbsp;&nbsp;&nbsp;strContext.Delete(0,nIndex+1);//删去空格之前的<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Edit2 = strContext;//赋给另外一个Edit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UpdateData(FALSE);<BR>怎么第二个输出为20

⌨️ 快捷键说明

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