You probably want to put a break after each case statement in your switch ? otherwise it will just go onto the next one
switch (number){
case 1:
break;
case 2:
break;
......
}
You need to look a little bit closer. There are breaks where they are intended to be.
>I'm having is that, for some reason, I'm only able to collect subset of generated data, meaning that not all of the data generated inside the program is passed into the external file.
I am not quite sure what its the question.
The program is saving to file only the three floating points you ask to save:THETA[1], THETA[2], THETA[3]. It makes me wonder where's THETA[0].
Also from this point of view, I don't know what ANSWER is, or where it comes from.
Neither P[0],P[1],P[2] are local to inverseKinematics() so I wouldn't know what they are. I just bring it up because the function relays heavily in exterior global variables.
Nevertheless, I wouldn't feel comfortable with pFile = fopen ("myfile.txt","a"); by itself.
It is always imperative to check that the result is an open file ready to accept data.
And so a check it is a must with every call to fprintf() writing to file.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218