Ok I will explain further. I work in a Computational Physics Lab, Personally I do Lennard - Jones Molecular Dynamics simulations to study the properties of metastable liquids, however, other people in this lab, and through-out the computational physics realm do different simulations and there is no standard output which these simulations follow, usually due to the fact they are independantly written. Now I want my visualization program to be completely portable between any type of simulation, and all that requires is a bit of configuring on the user's part to establish the format of their output (which is in turn my input). Essentially what I want is to set it up so that my ReadData() function will read from any text file, as long as the user has configured the program to do so. I know how I want to do it, but my question is will using void pointers in a fscanf(); and then, changing what variables those pointers point to, during configuration work? I will outline a simple pseudocode below.
Now if the user's format is say
int x, y, z , type,
void p1 p2 p3 p4 p5 p6 p7 p8
fscanf(file, format_str, p1, p2,p3, p4, p5, p6, p7,p8);
txt= z txt=y txt= x txt=type
then I want to have
format_str = "%s %f %s %f %s %i"
p1 -> dummy
p2 -> z
p3 -> dummy
p4 -> y
p5 -> dummy
p6 -> x
p7 -> dummy
p8 -> type
and I want all that to be changable incase the next person who use's my program comes along and their data format is x y z type, for example. They would set the format string (using easier techniques which I will outline in my program) and the program would then set the ptr's accordingly. That way I need only 1 read data function and just another function which rearranges what the ptr's point to and reassign's format_str.
Catch my drift? If not I will be happy to answer any questions. This seems intuitvly possible but I am unsure about the void pointers. My assumption is typecasting them? Or maybe using them as pointers to pointers of proper type?