Update for GCC 7.3.0
The latest gcc has changed. I have had to recompile Xbgi library (i.e. 2D graphics) and I found sscanf() works differently (i.e. 0X? is recognised as hexadecimal).
I have opted to migrate from BGI (Windows) and Xbgi (linux), to ezxdisp.
"ezx" is short and sweet and is available for Windows and Linux.
The latest version is available at http://morihit.net/ezxdisp/
Previously I used sscanf() as follows:
for (j=0;Line[j];j++) Line[j]=toupper(Line[j]);
tmp=strchr(Line,'G');
if (tmp!=NULL) {
sscanf((tmp+1),"%lf",&f1);
if (f1<0) f1=0;
block[i]->G=(long)f1;
}
It should read any number as a double which can be converted to long later.
Now "G0X7.122" is read as G=7, X=0.0 but "G1X7122" still works fine.
Now I have now coded:
for (j=0;Line[j];j++) Line[j]=toupper(Line[j]);
tmp=strchr(Line,'G');
if (tmp!=NULL) {
sscanf((tmp+1),"%ld",&d1);
if (d1<0) d1=0;
block[i]->G=d1;
}
AlanX
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.