Thanks, I have this now... but I'm not getting any print error output or changed text in the variables.txt file???
Code:
case kEventMouseMoved:
kindName = "MouseMoved";
GetEventParameter(inEvent, kEventParamMouseLocation,
typeQDPoint, NULL, sizeof(Point), NULL, &pt);
fprintf(stderr, "location - %.0f, %.0f - ", x2, y2);
switch (i){
case 1:
x1=pt.h;
y=pt.v;
i=2;
break;
case 2:
x2=pt.h;
y2=pt.v;
i=1;
xdouble=x2-x1;
ydouble=y2-y;
distance=distance+(sqrt(pow(xdouble, 2)))+(sqrt(pow(ydouble, 2)));
x1=x2;
y=y2;
i=2;
break;
{
char my_filename[] = "variables.txt";
FILE *myfile;
myfile = fopen(my_filename, "w");
if (myfile == NULL)
{
printf("ouch");
/* error message and appropriate action (exit, etc.) */
}
fprintf(myfile, "%d\n", 2);
/* ... */
}
}
break;