im writing code in C that reads a text file then outputs a new text file but im reading my data in as a string and i then need to find a character. is there a way to do this? Within the 'buffer' i need to find the character 'R' and take the Int value after is. how will i go about doing that?? thanks this is my code so far:
const char ch = 'R';
char *ret;
if(strcmp(data_in,"G3")==0)
{
if(fgets(buffer,60,p)!= NULL)
{
size_t len = strlen(buffer);
if (len > 0 && buffer[len-1] == '\n')
{
buffer[--len] = '\0';
}
ret= strchr(buffer, ch);
fprintf(o,"CC X0.0 Y%s.0\n",ret);
fprintf(o,"C%s DR+ R0 M\n",buffer);
}
}