Edited: how can i save the first string and then use the strcat func
void *threads_sorting (void *arg) {
struct args_sort *mydata;
mydata = (struct args_sort *) arg;
FILE *forig
char *file_name;
//file_name = (char*)malloc( sizeof(char) * 10 );
file_name = mydata->fname;
printf ("File Name: %s\n", file_name);
char *final_name;
//final_name = (char*)malloc( sizeof(char) * 20 );
final_name = file_name;
final_name = strcat(final_name, ".sorted");
printf ("File Name: %s\n", file_name);
printf ("FInal Name: %s\n", final_name);
forig = fopen(file_name,"r");
if(forig==NULL)
{
printf("Unable to open file\n");
exit(1);
}
}//end of function
Now the output is:
File Name: arch1.txt
File Name: arch1.txt.sorted //that's why it doesn't open
Final Name: arch1.txt.sorted
Unable to open file
The question is how can i save the first string and then use strcat, my bad.