5 Replies Latest reply: Dec 11, 2008 11:13 AM by 843785 RSS

    convert array to class

    843785
      Hi.

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

      I have this

      typedef struct
      {
      char sName[15];
      char sSecondName[15];
      }sMyStruct;

      Ok I recive the this array by socket

      <AAAAAAAAAAAAAAAbbbbbbbbbbbbbbbb>

      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;

      :)

      thanks