In multi thread application how can i redirect stderr & stdout in separate file as per thread?
i have multi thread application in which i m creating thread like this

    int main(int argc,char *argv[])
    {
        pthread_t thread_id[argc-1];
        int i;
        struct parameter thread_data[argc-1];
        int status;
        for(i=0;i<argc-1;i++)
    	{
    	thread_data[i].ip_filename = argv[i+1];
    	strcpy (thread_data[i].op_filename,argv[i+1]);
    	strcat (thread_data[i].op_filename,".h264");
    	}
    
       for(i=0;i<argc-1;i++)
        {
       	pthread_create (&thread_id[i], NULL , &thread_function, &thread_data[i]);
       }      
    }

now in thread function 

**i want to redirect stderr & stdout in one separate file as per thread**

somethig like thread log file

how can i do so.? 

In multi thread application how can i redirect stderr & stdout in separate file as per thread?
===

i have multi thread application in which i m creating thread like this

    int main(int argc,char *argv[])
    {
        pthread_t thread_id[argc-1];
        int i;
        struct parameter thread_data[argc-1];
        int status;
        for(i=0;i<argc-1;i++)
    	{
    	thread_data[i].ip_filename = argv[i+1];
    	strcpy (thread_data[i].op_filename,argv[i+1]);
    	strcat (thread_data[i].op_filename,".h264");
    	}
    
       for(i=0;i<argc-1;i++)
        {
       	pthread_create (&thread_id[i], NULL , &thread_function, &thread_data[i]);
       }      
    }

now in thread function 

**i want to redirect stderr & stdout in one separate file as per thread**

somethig like thread log file

how can i do so.? 
