Thread: printing a string

  1. #1
    Registered User
    Join Date
    Jul 2011

    printing a string

    Dear all:

    I am trying to print a string in a file using the following:

    fprintf(input, "EXTN=`date +\"\%A_H_M_S\"`\n");

    and getting the following :

    EXTN=`date +"0X0.0000000000001P-1022_H_M_S"`

    Why am I getting this? and how can I have "%A" in my string?



  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    If you want to print a literal percent sign, you need to use %% (just as you need to use \\ to get a literal backslash).

    %A means "print a floating point number in hexadecimal scientific notation format".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem printing string
    By gkoenig in forum C Programming
    Replies: 4
    Last Post: 05-04-2008, 10:01 PM
  2. printing a string from a pointer
    By zmaker5 in forum C Programming
    Replies: 9
    Last Post: 07-29-2007, 08:56 PM
  3. printing string from file
    By CynthiaRullan in forum C Programming
    Replies: 7
    Last Post: 07-15-2007, 09:28 PM
  4. seg fault when printing string
    By ccoder01 in forum C Programming
    Replies: 6
    Last Post: 04-23-2004, 05:30 AM
  5. printing a string
    By ktntech in forum C Programming
    Replies: 1
    Last Post: 01-24-2002, 05:09 PM