Hey
I need help with strtod, can anybody help me..?
I need to read a lot of coordinates from a file, whicj will be
translatet into double with strtod, and make a circle move
around the screen, with the coordinates from the file.
But i'm a bit unsure, how to use strtod and read the date from the file.
I have x and y, which shall make the circle go.
Can anybody give me some directions about fgets and how to
get the coordinates into the right x and y coordinates..
tx
Gugge
------------code ---------------------
x = 150.0;
y = 200.0;
drawCircle(x, y, BLACK);
drivecoord = fopen("xycoord.txt","r");
if(!drivecoord)
{
printf("FEJL - Filen kunne ikke findes.\n");
return 0;
}
while(!feof(drivecoord))
{
quitCheck ();
fgets(coord,80,drivecoord);
value = strtod(coord, &endptr);
printf("The string is %s the number is %lf\n", coord, value);
drawCircle(x, y, BLACK);
}
---------------------------