468,121 Members | 1,425 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

struct inside struct

Hello everone

I have code from c which I need to convert to c#, the c
code is following, as you can see there is a struct
inside struct

typedef struct
{
some variables....

typedef struct
{

some varibles...
}first;

}measure;

I have tried to convert this to to C# as following

public struct mesure
{
some variables...

public struct first
{
some varibles....
}
}

when I create instance of the struct I have just acces to
the varible which are inside the measure struct, I have
no Acces to the first struct,

if I try to take sizeof with the marshal as following it
just count the bytes for the variables for the measure
struct, not for the first struct;

How can this be managed

I have binary files which has been written by c
structered prgram, I need to read this file and get data
out of ot to write to database,

Regards

Jón Sveinsson
Nov 15 '05 #1
1 8449
Jón,
I have tried to convert this to to C# as following

public struct mesure
{
some variables...

public struct first
{
some varibles....
}
}


You have to add an instance of the inner struct to the outer, that's
not done automatically

public struct mesure
{
some variables...

public first first;

public struct first
{
some varibles....
}
}

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by uny ternally | last post: by
1 post views Thread by Bryan Parkoff | last post: by
20 posts views Thread by Elliot Marks | last post: by
67 posts views Thread by S.Tobias | last post: by
6 posts views Thread by Michael C | last post: by
6 posts views Thread by CptDondo | last post: by
12 posts views Thread by djhong | last post: by
18 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.