problem with an array of strings
- From: Peter Van Osta <pvosta unionbio-eu com>
- To: ORBit list <orbit-list gnome org>
- Subject: problem with an array of strings
- Date: Thu, 16 Oct 2003 17:53:31 +0200
Hi,
I want to use an array of strings in an object:
typedef string ABC[6];
.....
struct XYZ{
string name;
....
ABC pos;
....
};
I seem to do something wrong in the allocation of meory for "pos" as an
array of 6 strings.
In the code I declare (omitted Module and Interface):
XYZ *mypointer;
and allocate memory:
mypointer = XYZ__alloc( );
When setting the default values for the object, I want to fill the
datastructure and allocate all subelements, such as the strings:
mypointer->name = CORBA_string_alloc( 64 );
mypointer->name = CORBA_string_dup( "-" );
mypointer->pos ?????????????
for( i = 0; i < 5; i++ ){
mypointer->pos[i] = CORBA_string_alloc( 64 );
mypointer->pos[i] = CORBA_string_dup( "-" );
}
It looks that I will need to allocate "mypointer->pos" first, where to
find the routine to allocate the memory space ?
Best regards,
Peter Van Osta
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]