fprintf special characters

Hi Experts

I need to fprintf a double quote like this:

fprintf(pConfig->testStream,"FILE: "exp_%s","TEST")

Im expecting this to appear as a line in my file:

FILE: "exp_TEST

However the second quotation mark is causing me problems as the code is being interpreted as having one too many quotes!

How do I force the 2nd " to be treated as a litteral?
stummjAsked:
Who is Participating?
 
rockiroadsCommented:
Im trying to remember my C days

I think u prefix it with  \

something like

fprintf(pConfig->testStream,"FILE: \"exp_%s","TEST")
0
 
rubentrancosoCommented:
try use
fprintf(pConfig->testStream,"FILE: \"exp_%s","TEST")
when printing quotes u need to scape than
0
 
stummjAuthor Commented:
Ah yes - I thought I'd tried that but I used a forward slash rather than a back slash.
Thanks.
0
 
rockiroadsCommented:
stummj, you were pretty close then :)

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.