Code is not mine, it's from minised project...
Here is the whole function:
/* write a hex dump expansion of *p1... to fp
p1: the source
fp: output stream to write to */
static void listto(char *p1, FILE *fp)
{
p1--;
for (; *p1++; /* p1<spend */ ) /* no effect ? */
if (isprint(*p1))
putc(*p1, fp); /* pass it through */
else
{
putc('\\', fp); /* emit a backslash */
switch(*p1)
{
case '\b': putc('b', fp); break; /* BS */
case '\t': putc('t', fp); break; /* TAB */
case '\n': putc('n', fp); break; /* NL */
case '\r': putc('r', fp); break; /* CR */
case '\033': putc('e', fp); break; /* ESC */
default: fprintf(fp, "%02x", *p1 & 0xFF);
}
}
putc('\n', fp);
}
This will give you a better idea of what's going on...
Bye