Results 1 to 2 of 2

Thread: need help abt structures

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    4

    Exclamation need help abt structures

    hi all
    In my c# application,I am using functions of VC++.Net.
    One of the function in that VC++ dll is taking Char * as an argument.
    But in My C# application I have one structure variable.
    I want this structure variable to be passed to that VC++.Net dll's function.

    This is in C#.Net

    structure struct1
    {
    int i;
    char[] arr;
    };
    Am writing the following code under Button_click event(in C#)

    struct1 ss=new struct1()
    ss.i=10;
    ss.arr=new char[10];
    ss.arr="abcde".ToChararray();
    work(ss); ?? /***** this is the function in vc++.net ****??????????
    Now I want to pass thi structure variable(struct1) to the VC++.Net function which is having char * as its argument.
    The function in VC++.Net is like this..
    char * work(char * C)
    {
    /// some code
    }

    So plzz tell me Can I pass the structure from C#.Net to that VC++.Net function which is taking Char *.
    Thanks in advance.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: need help abt structures

    Look into "unsafe" code and pointers (C# does support pointers). MSDN has some good info about it.

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