ok..so my program uses threads..but the basics are this...lets say i have file1.c, file2.c and file3.c..
atm, i have defined the struct in a file called struct_definitions.h... so basically file1 creates the threads and then the thread is located in file2. the structure is passed to the thread through the thread creation argument. the thread in file2.c writes a value to the struct and ends..then the thread in file3 is supposed to read and print that value.
the reading of the value is ok, as soon after the read i print it and its correct. but when i print it out in the other function, the value comes as 0, which means that it is clearly wrong.
struct definition in struct_definitions.h
Code:
struct analog_input
{
float analog_input_value;
};
since everything works ok, i will post only the problematic read function which is supposed to read the struct
Code:
void *analog_printfunction0 (void *analogin0struct)
{
struct analog_input *ptr = (struct analog_input*) &analogin0struct;
printf("Analog In 0 value : %f\n",ptr->analog_input_value);
}
hope someone can help me!