VC++ Help: convert from System::String to const char*;
Expand Post »
I'm using VC++ .net to write a program for searching through files in a directory and then opening them. The only problem I have run into is opening the file. I tried using streamreader but this does not work for opening pdf files. Currently I'm using system ("start //location and name of file");
ex:
Now this works great except for the fact that I need for filename to be changed while in my program. I tried passing a string that was gathered earlier in the program into it and I get an error saying that cannot convert parameter 1 from System:: String ^ to const char *
code error:
System::String is not the same as std::string . The former is the .NET framework's string class that is used in C++/CLI code.
Your question is a Microsoft knowledge base article. It came up as the first hit when searching Google for your thread title.
I tried implementing those examples into my code but received varying errors from each. The main error was when trying to #include the header files that they supplied. Each method I fooled around with for an amount of time before I decided to ask here. I thought that the last method was my best hope because it states that it is available for Visual C++ 2008.
Last edited by desimator55; Oct 23rd, 2009 at 1:35 pm. Reason: Added information
The last example can't be compled with the express edition.
Oh, well then I guess I will have to get a complete version of Visual Studio 2008. So if and when I get this that code will work then? Are there any ways to work around this or do I have to locate the complete version? I have to leave for the weekend so thank you for the help and I'll check as soon as possible for an answer.
Last edited by desimator55; Oct 23rd, 2009 at 1:50 pm.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.