[c++]代码库
QString fileName = QFileDialog::getSaveFileName ( this, tr ( "Save File" ),
"",
tr ( "file ( *.CSV)" ) );
if ( fileName == "" )
return;
QTextCodec *code;
code = QTextCodec::codecForName ( "gb18030" );
std::string strbuffer = code->fromUnicode ( fileName ).data();
FILE *fileWrite = fopen ( strbuffer.c_str(),"w" );
QString strFemale = "Female Count";
QString strMale = "Male Count";
QString strPatientCount = "Patient Count";
QString str ="\n";
std::string strCountbuffer = code->fromUnicode ( strFemale+","+
strMale+","+strPatientCount+str+QString().setNum ( femaleCount ) +","+
QString().setNum ( maleCount ) +","+QString().setNum ( patientCount ) ).data();
QFile file;
file.open ( fileWrite, QIODevice::WriteOnly );
file.write ( strCountbuffer.c_str(), qstrlen ( strCountbuffer.c_str() ) );
file.close();