int readHex(text_t *text) { int rc = 0; char buf[12]; char *str = _safe_gets(text, buf, 12); if(*str) _scanf_getl(str, &rc, 16, 9, 0); /* not signed */ return rc; }
int readDec(text_t *text) { int rc = 0; char buf[40]; char *str = _safe_gets(text, buf, 39); if(*str) _scanf_getl(str, &rc, 10, 11, 1); /* signed */ return rc; }
int readBin(text_t *text) { int rc = 0; char buf[40]; char *str = _safe_gets(text, buf, 39); if(*str) _scanf_getl(str, &rc, 2, 32, 0); /* not signed */ return rc; }
unsigned gethex() { char buf[80]; safe_gets(buf, 80); unsigned x = 0; _scanf_getl(buf, (int*)&x, 16, 80, 0); return x; }
unsigned getfnum(int base, int isSigned, int width) { char buf[80]; safe_gets(buf, 80); if (width > 80) width = 80; unsigned x = 0; _scanf_getl(buf, (int*)&x, base, width, isSigned); return x; }