|
-
October 10th, 2004, 07:00 PM
#1
a structure with a vector as a member
Hello:
I have this interesting problem...
I have to use a c-library that contains a function that is defined as follow:
int func(char * cpData);
I have been using a structure accually a nested structure as follows
struct A
{
char cString;
char cAnotherstring;
}sA;
struct B
{
int iIndex;
float fData[MAXDATA];
}sB;
struct C
{
struct A nA;
struct B nB[8];
}sStream;
I can call this structure with now problems
using func((char *) &sStream);
I wanted to use a vector for the float fData
such as the struct B is as follows:
struct B
{
int iIndex;
vector< float> fData;
} sB;
when I call the function I getting garbaged data.
I do take care of reserving the data size.
In fact I can see that the correct data iscorrect, just prior to calling
this legecy function.
Is there a way I can convert somehow to c-array which the function understands
but be able to take advantage of the vector.
Your speedy reply wiill be vey much appreciated.
AD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|