LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which C++ type corresponds to LV string in .NET invoke node

Hi,

I need to use external C++ class library which usest _bstr_t string as file name type. I'm writing a .NET wrapper with managed C++ for the class so that I can access the class from Labview.

Now I have a problem. I'd like to pass string (filename) from labview to a method using the .NET invoke node.  I don't know which C++ string type corresponds to labview string type in the Labview .NET invoke nodes.  At least the following doesn't work.


#include <string>

using namespace std;

    bool Classname::FileOpen(string* eegfile)
    {
        _bstr_t bf=eegfile->c_str();
   ...
    }

nor the following


    bool Classname::FileOpen(char* eegfile)
    {

        _bstr_t bstrfile(eegfile);

   ...
    }

Message Edited by Tomi M on 11-21-2005 05:48 PM

--
Tomi Maila
0 Kudos
Message 1 of 2
(2,468 Views)
You need to use a .NET string, not a C++ string. For example, you want something like (VS.NET 2003 syntax)
 
    bool Classname::FileOpen(System::String __gc* eegfile)
    {
        _bstr_t bf((BSTR)Marshal::StringToBSTR(eegfile), false);
   ...
    }
 

Message Edited by Lycangeek on 11-21-2005 03:26 PM

0 Kudos
Message 2 of 2
(2,458 Views)