Passing and converting LPVOID

G

greyham

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!
 
V

Victor Bazarov

greyham said:
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![/QUOTE]


V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top