Thread: Ask about fprintf function?

  1. #1
    Registered User
    Join Date
    Jan 2002

    Question Ask about fprintf function?

    I write header file "ooo.h" and want to write this below text in ooo.h

    #define X "123"

    This below is some part of my code

    FILE *outp;
    CString output_filename;
    Output_filename = "ooo.h";
    outp = fopen(output_filename, "w");
    fprintf(outp, "#define X "123" ");
    fprintf(outp, "\n");
    if (output_filename)

    When I compile program there are 2 error messages happen cause by this line
    fprintf(outp, "#define X "123" ");

    I change that line to
    fprintf(outp, "#define X 123");

    So I can compile program and it write
    #define X 123
    but I want
    #define X "123"

    If you know how to solve my problem? Please tell me.
    Thank you.

  2. #2
    Join Date
    Sep 2001
    You'll need double quotes around the 123 ( ""123"" ).
    Also, don't put code in .h files if you are.
    Last edited by Shadow; 09-27-2002 at 11:28 PM.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 03:33 AM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM