It sais on that page you need a
void func(void *)
function... You have alot more...
You could do samenhing likje this:
1 2 3 4 5 6
|
typedef struct{
int Num;
char* pBuf;
}mystruct;
void* addem(mystruct* );
|
Last edited on
Good catch on what it told me I needed to have...!
As I said, I am new, and just kludging stuff together. So if I make my structure with all my variables, how do I pass all my variables to my function?
I
example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
typedef struct
{
char A;
char B;
}CHARS;
void loop( void* args )
{
CHARS *chars = (CHARS*)args;
while(1)
{
printf( "loop: %c %c\r\n" , chars->A, chars->B );
Sleep(2000);
}
}
int main()
{
CHARS chars1 = { '1' , '2' };
CHARS chars2 = { '3' , '4' };
// Create the second thread.
_beginthread( &loop, 0, &chars1 );
while(1)
{
printf( "main: %c %c\r\n" , chars2.A, chars2.B );
Sleep(1000);
}
return 0;
}
|
Last edited on
Thanks for all your help, you da man!
Last edited on