Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

fprintf special characters

Posted on 2006-05-11
4
Medium Priority
?
586 Views
Last Modified: 2012-05-05
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?
0
Comment
Question by:stummj
  • 2
4 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 2000 total points
ID: 16656782
Im trying to remember my C days

I think u prefix it with  \

something like

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

Expert Comment

by:rubentrancoso
ID: 16656798
try use
fprintf(pConfig->testStream,"FILE: \"exp_%s","TEST")
when printing quotes u need to scape than
0
 

Author Comment

by:stummj
ID: 16656801
Ah yes - I thought I'd tried that but I used a forward slash rather than a back slash.
Thanks.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 16656834
stummj, you were pretty close then :)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question