0

Please help me figure out what is wrong I can't find anything about this and haven't found the definition of this function C# keeps coming up and it doesn't apply.


    for (auto& p: fs::recursive_directory_iterator("c:"))
        {
            richTextBox1->AppendText("This works fine\n");
        }

    for (auto& p: fs::recursive_directory_iterator("c:"))
        {
            std::string pathString;

            fs::path path = p.path();

            pathString = path.string();

            //I don't know why it doesn't work like this VS won't compile if I try this. I have tried 
            //multiple different formats of string to no avail

            richTextBox1->AppendText(pathString);
        }
1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
Hlos90
  • 1
  • 1
  • 1
  • What does 'wont compile' mean? What's the error you get? – Roy2511 May 07 '20 at 02:47
  • Also what UI framework are you using? MFC? Win32? You should include that tag in the question or mention it somewhere. – Roy2511 May 07 '20 at 02:49
  • no instance of function "System::Windows::Forms::RichTextBox::AppendText" matches the argument list argument types are: (std::string) object type is: System::Windows::forms::RichTextBox ^. – Hlos90 May 07 '20 at 02:54
  • As far as UI is concerned I made a CLR project and added a form. – Hlos90 May 07 '20 at 02:56
  • Instead of converting to std::string, I think you need to use CLR string. Something like System::Convert::ToString(path.string()). Just a guess because I can't seem to find the documentation for CLR C++. – Roy2511 May 07 '20 at 03:30
  • You should [edit] the question to include the full compiler error details, rather than including it in a comment. – 1201ProgramAlarm May 07 '20 at 03:44

0 Answers0