64,647
社区成员
发帖
与我相关
我的任务
分享
int fileopener::OnactionOpen()//打开文件
{
using namespace std;
QString fileName = QFileDialog::getOpenFileName(this,
GBK::ToUnicode("打开文件"));
string gbkName=GBK::FromUnicode(fileName);//得到路径,以string储存
ifstream infile;
infile.open(gbkName.c_str(),ios_base::in);
string readtext;
ostringstream oss;
oss << infile.rdbuf();
readtext = oss.str();
ui.textEdit->setPlainText(GBK::ToUnicode(readtext));
infile.close();
return 0;
}