Ask about fprintf function?

This is a discussion on Ask about fprintf function? within the C Programming forums, part of the General Programming Boards category; I write header file "ooo.h" and want to write this below text in ooo.h #define X "123" This below is ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    68

    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)
    {
    fclose(outp);
    }
    ************************************************

    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
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    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-28-2002 at 12:28 AM.
    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, 04: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-30-2005, 12:21 AM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21