468,752 Members | 1,162 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,752 developers. It's quick & easy.

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 11689
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 zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.