当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 我有一个sqlserver 2000 数据库 其中有几个表中的字段的数据类型为 nvarchar 现发现在c++builder 中不认识 该字段 在sql explorer 中 不能打开表中的字段 错误为 could not find object bde erroe 8712 [$22][$8] 如果选择data 则只出现其它的字段 是不是c++builder 6.0 的问题??? 该如......
    摘要: 我在delphi7.0 component-->install component-->unit file name选择了quickrep.dcu 加入到已经有的包 提示one or more line were too long and hava been truncated 问题解决马上给分,各位老大帮忙了 我的qq:1162285 ......


紧求教:怎样讲一个文件的内容读入到一个字符串中去(包括\n换行符)

各位大侠,小弟我想做一个函数:  
  CString   getFileContent(CString   fileName){....}  
  就是输入一个文件名,然后将文件的内容读出来,写到一个字符串中,然后将此字符串返回。  
   
  急!!谢谢!!

NO.1   作者: vc_love

CFile   file;  
  CString   str="";  
  char     *ch;  
  file.Open(filename,CFile::modeRead);  
  int   filelenth=file.GetLength();  
                  ch=new   char[filelenth];  
  file.Read(ch,filelenth);  
  for(int   i=0;i<filelenth;i++)   str+=ch[i]  
  file.Close();  
  return   str;

NO.2   作者: he_zhidan

CString   str;  
  CFile   file;  
  file.Open("test",CFile::modeRead);  
  int   n   =   file.GetLength();  
          file.Read((void   *)(LPCTSTR)str,n);  
  AfxMessageBox(str);  
  file.Close();


 ·关于继承    »显示摘要«
    摘要: 如果我建了个dbedit输入框,里面有获得焦点时颜色改变,按回车到下一输入框等功能, 因为有很多类似的编辑框,我想在下面的输入框中能继承上面代码的功能,怎么办? 不好意思,才学delphi,请各位大虾指教. ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE