Results 1 to 2 of 2

Thread: need help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    need help

    how do I use pointers with struct or classes with String members? Is it possible?

    [code]
    struct myName
    {
    string first;
    string last;
    }

    myName * n;

    I get an error: Cannot take the address or size of a variable of a managed type ('memFunc_app.Form1.myName')

    is there a way to have a struct with a "string" type member? I tried StringBuilder but couldn't make it work. I could use array of char, but i don't know an easy way of initializing the array the way it is done in c++.

    for instance:
    Code:
    //c++ code
    
    char * str;
    str = new char[100];
    str = "John";
    can't do this in c#

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: need help

    Moved from C# CodeBank.

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