Converting ascii hex values to hex bytes

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Thu Oct 18 04:34:22 AEST 1990


In article <1990Oct17.162529.20096 at Neon.Stanford.EDU> dkeisen at Gang-of-Four.Stanford.EDU (Dave Eisen) writes:

That idiot Eisen had what appears to be a typo in his code:


int
convert_data (const char *ascii, char *four_bytes)
{
  char *p;
  int bytenum;

  for (bytenum = 0, p = ascii; bytenum < 4; bytenum++)
    {
      four_bytes[bytenum] = atoi (p);
      if ((p = strchr (p, '.')) == NULL)   /* strchr is called index in BSD */
        return -1;
      p++;  /* Omitted in the original posting */
    }

  return 0;
}

--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
1447 N. Shoreline Blvd.
Mountain View, CA 94043



More information about the Comp.lang.c mailing list