记一次从vs转到vc++6.0遇到的坑
错误1:strlen was not declared in thos scope
如果使用了strlen函数,但是<string.h>是不包括strlen的,要使用cstring**
所以需要添加头文件#include
错误2:error: no matching function for call to 'std::basic_ifstream::basic_ofstream(std::string&)
为C++编译版本比较低,这里解决方式可以使用.c_str()方法。
string filename = "1.txt";
ifstream fin;
fin.open(filename.c_str());
第二种方法:
cout<<"输入文件名及路径以创建该文件,如:E:/a.txt"<<endl;
char fileName[10];
cin>>fileName;
ofstream fout(fileName);