i need a data in the following format
1 "one"
2 "two"
but iam unble to this
ima getting
1 one
2 two
my code
fprintf(f1,"1""one");
fprintf(f1,"2""two");
how we can write double quotations in file
thank u
sree
i need a data in the following format
1 "one"
2 "two"
but iam unble to this
ima getting
1 one
2 two
my code
fprintf(f1,"1""one");
fprintf(f1,"2""two");
how we can write double quotations in file
thank u
sree
You might wanna try :
Code:fprintf(f1,"%s","1 \" one \" ");
In the middle of difficulty, lies opportunity
In other words, to include a literal " character in a double quoted string, escape it with \":
As you can see, you can also print backslashes (\) with \\. You can also print single quotes (') with \', though you only need to escape single quotes inside single quotes:Code:printf("printf(\"Hello, World!\\n\");"); /* prints printf("Hello, World!\n"); */
Using single quotes in double quoted strings or vise versa without escaping is perfectly all right.Code:putchar('\'');
Code:putchar('"'); printf("'");
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.