![]() |
![]()
| ![]() |
![]()
NAMEstrcstr - convert memory block to printable C string notation SYNOPSIS#include <publib.h> void strcstr(char *str, size_t max, const void *block, size_t n); DESCRIPTIONstrcstr converts the contents of an arbitrary memory block (which need not be a zero terminated string) into a printable notation using normal C string literal syntax. This can be used for example to store potentially binary data in a file, or in debugging outputs. All characters for which there is a simple shorthand escape sequence (', ", ?, \, \a, \b, \f, \n, \r, \t, \v) are stored using that notation. \0 is stored as \0. All other non-printable characters are stored using a hexadecimal escape sequence. All other printable characters are stored as is. The isprint(3) macro is used to determine whether a character is printable (i.e., whether it is printed as is, or using special notation). Therefore, the output depends on the locale. RETURN VALUEstrcstr returns nothing. EXAMPLEThe following code dumps input to the standard output in a guaranteed (modulo locale bugs) printable format. It might be used for debugging.
SEE ALSOpublib(3), strins(3) AUTHORLars Wirzenius (lars.wirzenius@helsinki.fi)
|