473,587 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 984
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******@discu ssions.microsof t.com> wrote in message
news:FA******** *************** ***********@mic rosoft.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_COM PL:
unsafe
{
tDEVFOUND *a;
a = (tDEVFOUND *)msg.LParam.To Pointer();
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******@discu ssions.microsof t.com> wrote in message
news:FA******** *************** ***********@mic rosoft.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
4542
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, and at the end there is even pure mindstorming text left in, but already I think it can be very useful. <url: http://home.no.net/dubjai/win32cpptut/special/pointers/preview/pointers_01__alpha.doc.pdf>.
102
5947
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" ( i am talking of unix machine ) while trying to read that location. Then how can i distinguish between a NULL pointer and an invalid location ? Is this essential that NULL pointer should not point to any of the location in the virtual address...
9
5050
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 = getter(file); What type should I give to `getter' so that the compiler does not issue
11
2183
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
32069
by: Danijel Babic | last post by:
Hello! Can you tell me how to set pointer to variable in VB.NET Thank you!
2
240
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
2817
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 contents, use the "Bookmarks" tab in Adobe Acrobat. Comments, corrections, praise, nits, etc., are still welcome!
64
3398
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 pointers. Can someone please explain why? thanks. Zytan
25
13006
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 *p, void *q) that will take any two pointers and decide whether they can be compared or not. I really can't think how to do this - any suggestions?
0
7923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7852
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.