fprintf special characters

Posted on 2006-05-11
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:


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?
Question by:stummj
    LVL 65

    Accepted Solution

    Im trying to remember my C days

    I think u prefix it with  \

    something like

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

    Expert Comment

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

    Author Comment

    Ah yes - I thought I'd tried that but I used a forward slash rather than a back slash.
    LVL 65

    Expert Comment

    stummj, you were pretty close then :)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now