I need to append a number at the end of the word flare depending on how many I have. That part works great. My problem is when I go to print it to the screen. I would like the program to output the value of what (Camera::Table[Id]->sensor->flare1) sensor is pointing at, in this case, flare one. If the program were to continue it would output the value pointing at flare2, flare3, flare4,... until the limit is reached.
What I get as the output is the following:
lens_pos1=¨Camera::Table[Id]->sensor->flare1¨
lens_pos2=¨Camera::Table[Id]->sensor->flare2¨ .......
How can I output the value of flare1 instead of pasting the string?
What I want is the following:
lens_pos1=¨10.3¨ lens_pos2=¨12.4¨.....
Where the values 10.3, 12.4 would be those of flare1 and flare2 respectively taken from a seperate C file.
for(int i = 1; i <= nbflares; i++)
{
char integer_string[32];
sprintf(integer_string, "%d", i);
char flare[100] = "Camera::Table[Id]->sensor->flare";
strcat(flare,integer_string);
fprintf(yyout, "lens_pos%d=\"%s\" ",i,flare);
}