I have this token in my .lex file:
[a-zA-Z0-9]+ { yylval = yytext; return ALPHANUM; }
and this code in my .y file:
Sentence: "Sphere(" ALPHANUM ")."
{
FILE* file = fopen("C:/test.txt", "a+");
char st1[] = "polySphere -name ";
strcat(st1, $2);
strcat(st1, ";");
fprintf(file,"%s", st1);
fclose(file);
}
I get this error when I try to compile:
warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast
So $2 is an int, how do I make it a string?
For example: "Sphere(worldGlobe)." I want $2 to have the string value worldGlobe here.
Thanks for any help
#define YYSTYPE char*
in the prologue part of the .y file. – MtnViewJohn