I could use some help passing this file pointer to a thread to have the thread write to an output file. Currently the file is not being written to at all and I am not getting any errors and working.
void *ThreadTwo(void *param){
FILE *outputFile = param;
// Condition for even
if (r == 0) {
fprintf(outputFile, "%d\n", globalValue);
fprintf(outputFile, "%d\n", globalValue);
printf("twice becase it is even\n");
}
else {
fprintf(outputFile, "%d\n", globalValue);
printf("Once because it is odd\n");
}
}
pthread_exit(NULL);
}
int main() {
FILE *outputFile;
outputFile = fopen("hw3.out", "w");
pthread_create(&th[1], NULL, ThreadTwo, &outputFile);
fclose(outputFile);
return 0;
}