Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: unknown conversion type character ‘"’ in format when using dprintf

Tags:

c

I am getting this compiler (gcc 4.5) warning:

Formatter.cpp:23: warning: unknown conversion type character ‘"’ in format

And this is my code at line 23:

dprintf (fd, "<svg width=\"100%\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">");

Can somebody spot what am I doing wrong and what causes the warning ?

like image 764
michael Avatar asked Mar 09 '10 22:03

michael


1 Answers

You need to escape all occurences of % - the printf family of function treats them as format specifiers and tries to parse the next character (for instance as in %s). You escape them by doubling (%%).

like image 78
Alexander Gessler Avatar answered Jan 01 '23 23:01

Alexander Gessler