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
Printable View
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 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("'");