471,627 Members | 1,479 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,627 software developers and data experts.

fixed arrays

Hello

I have a c++ unmanaged struct that has as one of its components an
array of constant length. To transform it in managed array I have to
use something like:

public struct blabla
{
....
fixed public char fixedArray[10];
....
}

when I use the struct, it is clear that fixedArray is of type char*.
The question is if i can use somehow fixedArray as an array, without
the pointer logic.

Thanks

Feb 6 '06 #1
1 1787
The question is if i can use somehow fixedArray as an array, without
the pointer logic.


No you can't, it's not a real array. But perhaps you can change your
struct to

public struct blabla
{
....
[MarshalAs(UnmanagedType.ByValArray, SizeConst=10)]
public char[] fixedArray;
....
}
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Joshua Kolden | last post: by
11 posts views Thread by Linny | last post: by
2 posts views Thread by Chris Finlayson | last post: by
3 posts views Thread by Dr. Len | last post: by
2 posts views Thread by coz | last post: by
8 posts views Thread by nickooooola | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.