0

如何将字符串作为路径传递到此处

 void SaveLogFile()
         {              
             logTxt->SaveFile(String::Concat
                 (System::Environment::GetFolderPath
                (System::Environment::SpecialFolder::Personal),                                         
                 "\\Testdoc.rtf"), RichTextBoxStreamType::RichNoOleObjs);
         }

我不知道如何设置非 SpecialFolder

4

1 回答 1

0

来自MSDN

void SaveMyFile()
   {
      // Create a SaveFileDialog to request a path and file name to save to.
      SaveFileDialog^ saveFile1 = gcnew SaveFileDialog;

      // Initialize the SaveFileDialog to specify the RTF extention for the file.
      saveFile1->DefaultExt = "*.rtf";
      saveFile1->Filter = "RTF Files|*.rtf";

      // Determine whether the user selected a file name from the saveFileDialog. 
      if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK &&
         saveFile1->FileName->Length > 0 )
      {
         // Save the contents of the RichTextBox into the file.
         richTextBox1->SaveFile( saveFile1->FileName );
      }
   }

看看System::String^这里是如何创建的。也这样做...

于 2013-04-06T21:20:23.433 回答