c - Using printf without having to escape double quotes? -


in c not possible use ' printf of string. however, have text full of double quote ", , need escape of them as

printf("this \"test\" \"text\""); 

is possible printf in way without escaping ". mean using character wrapping string.

not recommended, can use macro:

#include <stdio.h> #define s(x) #x  int main() {     printf(s(this "is" string (with nesting)!\n)); } 

this prints

this "is" string (with nesting)! 

now delimiters balanced () characters. however, escape single ), ", or ' characters, have write s(right paren: ) ")" s(!\n), quite ugly. technique not recommended writing maintainable code.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -