5 Replies Latest reply on Dec 11, 2008 5:13 PM by 843785

    convert array to class


      I try to explain my problem in C/C++

      I have this

      typedef struct
      char sName[15];
      char sSecondName[15];

      Ok I recive the this array by socket


      if I make a substring and take this string: AAAAAAAAAAAAAAAbbbbbbbbbbbbbbbb
      i can make

      sMyStruct sMyStr;

      memcpy(&sMyStr,"AAAAAAAAAAAAAAAbbbbbbbbbbbbbbbb", sizeof (sMyStr));

      and y can read/write in my struct type;

      Now I create the folowing class

      class MyClass implements serializable
      public char[] sName = new char[15];
      public char[] sSecondName= new char[15];

      can i make somethig like this???:

      Object Aux = "AAAAAAAAAAAAAAAbbbbbbbbbbbbbbbb";
      MyClass miClass = (MyClass) Aux;