471,321 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Pointers and Mangaged types

I have the follow srtuct

public struct tDEVFOUND
{
public char[] bda;
public char[] dev_class;
public char[] name;
public int connected;
};

and i want to be able to the members, but i wanted to make a pointer..ie
tDEVFOUND *a;

but i get a compile error...is there anyway to do this??
Jul 21 '05 #1
2 916
In unsafe mode, you can have pointer; however, I don't see the purpose here
for having a pointer to tDEVFOUND. Also, don't forget that with pointers,
you will loose some capabilities of the managed environment.

See:
http://msdn.microsoft.com/library/de...detutorial.asp

http://msdn.microsoft.com/library/de...vclrffixed.asp

S. L.

"Thaynann" <Th******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
I have the follow srtuct

public struct tDEVFOUND
{
public char[] bda;
public char[] dev_class;
public char[] name;
public int connected;
};

and i want to be able to the members, but i wanted to make a pointer..ie
tDEVFOUND *a;

but i get a compile error...is there anyway to do this??

Jul 21 '05 #2
it may seem odd to have a pointer to the tDEVFOUND, but this is why

protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
case WM_BRCM_INQ_COMPL:
unsafe
{
tDEVFOUND *a;
a = (tDEVFOUND *)msg.LParam.ToPointer();
destinationForm.OnDevFound(a->bda, a->dev_class, a->name, a->connected);
}
break;
..
..
..
}

this is the code i am trying to get working, howeverit wont complie

"Sylvain Lafontaine" wrote:
In unsafe mode, you can have pointer; however, I don't see the purpose here
for having a pointer to tDEVFOUND. Also, don't forget that with pointers,
you will loose some capabilities of the managed environment.

See:
http://msdn.microsoft.com/library/de...detutorial.asp

http://msdn.microsoft.com/library/de...vclrffixed.asp

S. L.

"Thaynann" <Th******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
I have the follow srtuct

public struct tDEVFOUND
{
public char[] bda;
public char[] dev_class;
public char[] name;
public int connected;
};

and i want to be able to the members, but i wanted to make a pointer..ie
tDEVFOUND *a;

but i get a compile error...is there anyway to do this??


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

102 posts views Thread by junky_fellow | last post: by
9 posts views Thread by Mikhail Teterin | last post: by
11 posts views Thread by junky_fellow | last post: by
11 posts views Thread by Danijel Babic | last post: by
2 posts views Thread by Thaynann | last post: by
64 posts views Thread by Zytan | last post: by
25 posts views Thread by J Caesar | last post: by
reply views Thread by rosydwin | 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.