I have a C tokenizer library I'm using for a personal project.
It returns escaped characters as a char array of literals. So for example the string "\n" gets returned as this char array:
[][n]
Instead of this (desired) array:
[\n]
Is there an easy way in C to convert the first char array into the second char array without manual parsing?
Here is code example of what I'm after:
char test[2];
test[0] = '\\';
test[1] = 'n';
char c = someFunction(test)
printf("A %c B", c);
Desired Output:
A
B
Is there a way to do this using any obscure tricks or do I need to roll my own function?
Thanks!