why threads didn't show words in *.txt files?????????????
hey
i wrote this program:
#include <pthread.h>
#include <stdio.h>
struct char_print_parms
{
char character;
int count;
};
void* char_print (void* parameters)
{
struct char_print_parms* p = (struct char_print_parms*) parameters;
int i;
for (i = 0; i < p->count; ++i)
fputc (p->character, stderr);
return NULL;
}
int main ()
{
//int j;
//for (j = 0; j<200000;j++)
////{
//printf (" %d ",j);
//}
pthread_t thread1_id;
pthread_t thread2_id;
struct char_print_parms thread1_args;
struct char_print_parms thread2_args;
thread1_args.character = '1';
thread1_args.count = 30000;
pthread_create (&thread1_id, NULL, &char_print, &thread1_args);
thread2_args.character = 'a';
thread2_args.count = 20000;
pthread_create (&thread2_id, NULL, &char_print, &thread2_args);
pthread_join (thread1_id, NULL);
pthread_join (thread2_id, NULL);
return 0;
}
then in this program you will have print of number (1)
for 30000 times and word (a) for 20000 times but if you want to have them in text file the word (a) doesn't shown why???????????????????
help me please.
|