double bx=100,by=100;
void ShiftCoords(double *x, double *y)
{
*x=*x+100;
*y=-*y+100;
}
{
FILE *fp;
char *str,buf[1000];
char subbuf[100],*s1;
char buf2[100],*s2;
char buf3[100],*s3;
char buf4[100],*s4;
ShiftCoords(&atof(buf3),&atof(buf4))
if ((fp = fopen("test.txt", "r")) == NULL) {
printf("ファイルが開けません\n");
return EXIT_SUCCESS;
}
while (fgets(buf, 1000, fp) != NULL) {
str=buf;
while((*str!='\0'){
if(*str!='\0' && *str=='G'){
*str++;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
s2=buf2;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
while(*str!='\0'&&(isdigit(*str) || *str=='-' || *str=='.'))
*s2++=*str++;
*s2='\0';
}
if(*str!='\0' && *str=='X'){
*str++;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
s3=buf3;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
while(*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.')) *s3++=*str++;
*s3='\0';
}
if(*str!='\0' && *str=='Y'){
*str++;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
s4=buf4;
if((*str!='\0' &&(isdigit(*str) || *str=='-' || *str=='.'))
while(*str!='\0' &&(isdigit(*str) |*str=='||*str=='.')) *s4++=*str++;
*s4='\0';
}
else
str++;
}
CDC *v;
v=GetDC();
if((int)atof(buf2)==92){
MoveTo((int)atof(buf3),(int)atof(buf4));
bx=(int)atof(buf3);
by=(int)atof(buf4);
ReleaseDC(v);
}
else if((int)atof(buf2)==01){
MoveTo((int)bx,(int)by);
LineTo((int)atof(buf3),(int)atof(buf4));
bx=(int)atof(buf3);
by=(int)atof(buf4);
ReleaseDC(v);
}
}
fclose(fp);
return 0;
}
昨日教えていただいたプログラムに符号-を扱えるよう点を移動する関数を組み込んだモノなのですが
&の左辺値がありませんと出ます
>>ShiftCoords(&atof(buf3),&atof(buf4))
ここがおかしいみたいなんですが・・
double A=(int)atof(buf3);
double B=(int)atof(buf4);
ShiftCoords(&A,&B)
とするとエラーは出なくなったのですが図形がおかしくなりました。
原因と対策を教えてください。