CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    17

    VB equivalent to C++ char *

    Hi group,

    I have a vb.net project (vb2005) which needs to call a C++ class module which I have added to the project. The C++ module accepts as input a char * variable, which has no equivalent in vb. On the vb side the variable is a string. I have successfully added and tested simple C++ calls and they all work fine, but I cannot get this to work, best I can do is to get vb to think its of type SByte.

    I'm told that in .Net all data types are compatible at some level. I need to somehow represent a string as char * in vb, or a char pointer as string in C++, but don't know how to do it or the best way to go about. I'm totally rusty at C++ and would rather do it in vb.

    Thanks...

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: VB equivalent to C++ char *

    Maybe our enemies have a solution :

    http://www.codeproject.com/Questions...nter-in-VB-Net

  3. #3
    Join Date
    Apr 2012
    Posts
    43

    Re: VB equivalent to C++ char *

    Just pass the String as you normally would. P/Invoke would take care of the rest. Can you post your declaration of this function ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured