新建文件对话框,选择路径,新建并写入文件

//新建文件对话框,选择路径,新建并写入文件 
 CFileDialog dlg(FALSE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
  "All Files(*.TXT)|*.TXT||",AfxGetMainWnd());
 CString strPath,strText="";
 char write[1000000];
 if(dlg.DoModal()==IDOK)
 {
  strPath=dlg.GetPathName();
  if(strPath.Right(4)!=".txt")
   strPath+=".txt";
  CFile file(_T(strPath),CFile::modeCreate|CFile::modeWrite);
  strcpy(write,"set_value ka_r [ expr ");
  strcat(write,ka_r);
  strcat(write, " ] ; #  (I) UL: BS recv. ante Num/nset_value ka_s [ expr ");
  //strcat(write,"set_value ka_r [ expr "); 
  //strcat(write,c);
  //strcat(write,"]/nset_value noiseonoff [ expr 1.0  ] ; #  (R)");
  file.Write(write,strlen(write));
  file.Close(); 
 }

你可能感兴趣的:(null,file,c)