I have a zero terminated string:
char* s = ...;
and I am generating C source code (at runtime) and I want to output a string literal representing s that will produce an identical string to s in the generated C program.
The algorithm I am using is:
Output "
Foreach char c in s
if c == " output \"
else if c == \ output \\
else output c
Output "
Are there any other characters that I need to give special treatment other than "
and \
?