473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 974
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document,...
102
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV"...
9
by: Mikhail Teterin | last post by:
Hello! I'd like to have a variable of a pointer-to-function type. The two possible values are of type (*)(FILE *) and (*)(void *). For example: getter = straight ? fgetc : gzgetc; nextchar...
11
by: junky_fellow | last post by:
Do all double pointers have same size on a particular implementation. eg char **c_ptr; int **i_ptr; Is the size of c_ptr and i_ptr always same (on same implementation) or it may be different...
11
by: Danijel Babic | last post by:
Hello! Can you tell me how to set pointer to variable in VB.NET Thank you!
2
by: Thaynann | last post by:
I have the follow srtuct public struct tDEVFOUND { public char bda; public char dev_class; public char name; public int connected; };
14
by: Alf P. Steinbach | last post by:
Not yet perfect, but: http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01.pdf http://home.no.net/dubjai/win32cpptut/special/pointers/ch_01_examples.zip To access the table of...
64
by: Zytan | last post by:
I know there are no pointers in C#, but if you do: a = b; and a and b are both arrays, they now both point to the same memory (changing one changes the other). So, it makes them seem like...
25
by: J Caesar | last post by:
In C you can compare two pointers, p<q, as long as they come from the same array or the same malloc()ated block. Otherwise you can't. What I'd like to do is write a function int comparable(void...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.