For some reason the following is not working:
int i;
for(i = 1; i < argc; i++) // Create thread for each dataset.
{
filename = strcat(argv[i], ".sdx"); // Concatenate file-extension '.sdx' to basename.
pthread_attr_init(&attr); // Set the attribute of the thread (default).
pthread_create(&tid[i], &attr, start_routine, filename); // Create thread.
pthread_join(tid[i],NULL); // Join thread after it completed.
}
It works if I only pass in one file, but more than that gives a segmentation fault. I dont understand, everything works if I dont concatenate the file extension, and instead pass in the full filename (including its extension) as a command line argument.