How can I strip a string with all \\n and \\t in C?
This is a c string function that will find any character in accept
and return a pointer to that position or NULL if it is not found.
#include
char *strpbrk(const char *s, const char *accept);
Example:
char search[] = "a string with \t and \n";
char *first_occ = strpbrk( search, "\t\n" );
first_occ
will point to the \t, or the 15 character in search
. You can replace then call again to loop through until all have been replaced.