471,081 Members | 1,175 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Passing and converting LPVOID

Hi. I'm a beginner to C++ so bear with me. I'm trying to pass a
character array to a new thread so I thought I could pass the pointer
to the character array and cast it as a LPVOID (I know nothing about
LPVOIDs by the way). So I currently have:

AfxBeginThread(myThread,(LPVOID) *myBuffer);

My method myThread looks like:

UINT myThread(LPVOID LParam) {
....[code]...
char* sendBuffer = (char*)LParam;
....[code]...
}

But sendBuffer doesn't point to myBuffer. Any suggestions? Sorry I
can't describe the problem better - I hope you know what I want to do.
But thanks for the help!

Jul 23 '05 #1
2 12008
greyham wrote:
Hi. I'm a beginner to C++ so bear with me. I'm trying to pass a
character array to a new thread so I thought I could pass the pointer
to the character array and cast it as a LPVOID (I know nothing about
LPVOIDs by the way). So I currently have:

AfxBeginThread(myThread,(LPVOID) *myBuffer); ^
Drop the asterisk here.
My method myThread looks like:

UINT myThread(LPVOID LParam) {
...[code]...
char* sendBuffer = (char*)LParam;
...[code]...
}

But sendBuffer doesn't point to myBuffer. Any suggestions? Sorry I
can't describe the problem better - I hope you know what I want to do.
But thanks for the help!

V
Jul 23 '05 #2
Thanks!! Works great!

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Toni | last post: by
8 posts views Thread by asit | 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.