Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
unsigned gethex()
{
    char buf[80];
    safe_gets(buf, 80);

    unsigned x = 0;
    _scanf_getl(buf, (int*)&x, 16, 80, 0);

    return x;
}
Exemplo n.º 5
0
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;
}