|
A 'std::string is not a pointer. The size of the parameter passed is the size of a pointer so
that's the largest object you can pass.
Maybe passing the address of your 'std::string' will work. You'll have to cast it back to
a pointer to a std::string in your threadproc.
See DavidCrow's reply.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
|
darkcloud.42o wrote: //What i need to do is pass a string from the main() to the threadprocess.. Please Help.
void __cdecl threadprocess( void *params )
{
char *p = (char *) params;
strcat(p, "World");
}
void main( void )
{
char *s = new char[12];
strcpy(s, "Hello ");
_beginthread(threadprocess, 0, s);
...
delete [] s;
s = NULL;
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
ic that appears to be working but i need to have the char s to be used right after the threadprocess completes... which is modified inside threadprocess... see what i mean..
|
|
|
|
|
darkcloud.42o wrote: ...i need to have the char s to be used right after the threadprocess completes... which is modified inside threadprocess... see what i mean..
If you are creating a secondary thread, and then just waiting for it to complete, why bother creating it?
In any case, you'll need to implement some sort of synchronization object.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
cause i want to have it on a separate thread because it will serv up to 3-10 diff functions each function must be able to operate simultaniously..
eg... it will execute 1-10 threads at once per motherthread and wait for return here...
plus i need to use this thread outside the motherthread so its used all over the freeking app....
I have the threads part setup and it will work.. but i have to have the return on that variable.. could be a socket in some other thread some other time... believe me there are networking situations where this is required...
i see what your saying i could do it another way with limited function... but i will save days of programing/debugging..
I tell you what you contact me via email and ill send you my app what ive got here...
darkcloud.42o@gmail.com
-- modified at 17:10 Thursday 22nd March, 2007
|
|
|
|
|
This code leaks the thread HANDLE . From MSDN: "the handle returned by _beginthreadex has to be closed by the caller of _beginthreadex".
If you don't need the HANDLE make your code look soemthing like this:
HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, threadprocess, NULL, 0, &sid);
CloseHandle(hThread);
Note that closing the HANDLE doesn't terminate the thread. You may want to add error checking which I didn't include in my example.
Steve
|
|
|
|
|
Hey if you can convert a handle to socket.. it would work... is it possible...
|
|
|
|
|
I don't understand.
Steve
|
|
|
|
|
Ok so i got the variable passed to child threads and they can function..
but i need to pass more than 1 variable to the thread char* s and SOCKET ls;
lets not worry about the return on the child thread right now.... if i can 2 variables passed the whole process can be done inside child thread..
but one question... about that.. unsigned __stdcall test(void* params){ return 3; ) this return here how can i axs that??? can i access a process like int test(){ return 0; } be accessed from open threads at the same time?
btw
rigth now its FTP/WEB SERVER with Advanced custom admin functions with GUI.
-- modified at 12:40 Friday 23rd March, 2007
|
|
|
|
|
hi,
i am doing a prj on face detection. i have now captured and saved the images in VC++ but nw hace to detect only the face part from the entire image..
u hav any clue how to implement it in VC++ ????
|
|
|
|
|
That's way to broad a question for a forum. You should google for articles on what is a huge topic.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
so how do i detect only the face from the image???
|
|
|
|
|
hum, as you seem not to get what christian said, here[^] is a starting point...
hope that helps
|
|
|
|
|
(reprinted without permission! )
You should google for articles on what is a huge topic.
|
|
|
|
|
even better :
You should Google for articles on what is a huge topic
|
|
|
|
|
|
wow, 20 february, it doesn't seem to be that urgent ... !!!
|
|
|
|
|
Hi, we've learned at school that,
in face detection the color of lips can give a clue to find the face
if you find the position of lips you can use the ratio of the face
in human face there's a symmetry and all parts of the face has an arithmetical ratio to another, this may help you,
but it may not be able to use coz women use lipstick,
may be u can use horizontal and vertical histogram together (intersection of them)
or you may use dynamic quantization to find similar colors together as a label
(i mean labelization, like Photoshop's technique, you touch to a pizel then it draws a closed area)
i think the old replyers are right this is a technical research not a part of code
you must search for the academic researches
|
|
|
|
|
|
First ‘Maximilien’ gave you a good place to start, second if you need to ask this question then you may be in over your head. Look for code that can take an image apart. If you can not break it down, then you are in trouble. If you can, than even a pimple can tell you what you need to know.
Keep searching!
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
...<br />
...<br />
BYTE *pbyCmd;<br />
pbyCmd = new BYTE[byCount+1];<br />
...<br />
...<br />
if (pbyCmd) delete pbyCmd;<br />
...<br />
...
Is this correct code. which I am posting here above. Please let me know?
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
G Haranadh wrote: pbyCmd = new BYTE[byCount+1];
Why +1 ?
G Haranadh wrote: if (pbyCmd) delete pbyCmd;
No.
if (pbyCmd) delete [] pbyCmd;
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|