Is it possible to use a function to detect non-printable characters using isctrl() and use printf with the% C specifier to print them as "\ n", for example?
Or should I write if for each control and printf("\\n") for example ..?
Well, thanks to all the people who see below - this is not possible, you need to indicate each situation. Example:
if (isctrl(char))// WRONG printf("%c", char); if (char == '\n')//RIGHT, or using switch. printf("\\n");
source share