473,511 Members | 15,477 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 979
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
4501
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
5904
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
5042
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
2178
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
32058
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
2807
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
3368
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
12989
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
7153
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
7432
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...
1
7093
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
5676
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,...
1
5077
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
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...
0
1583
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 ...
0
452
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...

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.