44424742 发表于 2013-1-26 13:38:00

字符转换与文件为空的判断

String与string的转化String转化为std::string例子:CString strMfc="test";std::string strStl;strStl=strMfc.GetBuffer(0);std::string转化为CString例子:CString strMfc;std::string strStl="test";strMfc=strStl.c_str();文件为空的判断方法ofstream App("fp.txt", ios::app);App.seekp(0,ios::end);ofstream::pos_type end_mark=App.tellp();App.seekp(0,ios::beg);ofstream::pos_type beg_mark= App.tellp();if(beg_mark==end_mark)//表示空文件
页: [1]
查看完整版本: 字符转换与文件为空的判断