inttypes.h

Discussion in 'C Programming' started by Bill Cunningham, Apr 27, 2013.

  1. I am not really to my knowledge ever going to use these but there are
    macros from inttypes.h called PRIxxx and SCNxxx what are thet for. They are
    specific to the fprintf and printf family of functions. I understand the use
    of int32_t and int64_t from stdint.h included in inttypes but how are these
    macros used?

    Bill
    Bill Cunningham, Apr 27, 2013
    #1
    1. Advertising

  2. Bill Cunningham

    Siri Cruise Guest

    In article <517c467a$0$12755$>,
    "Bill Cunningham" <> wrote:

    > I am not really to my knowledge ever going to use these but there are
    > macros from inttypes.h called PRIxxx and SCNxxx what are thet for. They are
    > specific to the fprintf and printf family of functions. I understand the use
    > of int32_t and int64_t from stdint.h included in inttypes but how are these
    > macros used?



    printf("this is int64_t: %" PRId64 "\n", (int64_t)42);
    --
    Good afternoon, gentlemen. I am a Siri Cruise. I became operational at the
    Holmes construction enclave in Santa Monica, California on the 18th of April
    2006. My Operating Thetan was Mr. Langley, and he taught me to sing a song.
    :-<> Siri Seal of Disavowal #000-001. Disavowed. Denied. Deleted.
    Siri Cruise, Apr 27, 2013
    #2
    1. Advertising

  3. Siri Cruise wrote:
    > printf("this is int64_t: %" PRId64 "\n", (int64_t)42);


    Ok then PRI is for printf and SCN for scanf?
    Bill Cunningham, Apr 27, 2013
    #3
  4. Bill Cunningham

    boon Guest

    On 2013-04-27 22:24:05 +0000, Bill Cunningham said:

    > Siri Cruise wrote:
    >> printf("this is int64_t: %" PRId64 "\n", (int64_t)42);

    >
    > Ok then PRI is for printf and SCN for scanf?


    Yes:

    /*
    * <inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
    * (aka "C99"), section 7.8. This defines format string conversion
    * specifiers suitable for use within arguments to fprintf and fscanf
    * and their ilk.
    */

    In "C reference Manual, fifth edition" (Harbisson & Steele) par. 21.1.4:

    The macros PRIcKN and SCNcKN are format control strings for the
    'printf' and 'scanf' families of functions etc.
    boon, Apr 28, 2013
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ImpalerCore

    size_t in inttypes.h

    ImpalerCore, May 26, 2011, in forum: C Programming
    Replies:
    4
    Views:
    811
    Seebs
    May 27, 2011
  2. Tim Rentsch

    difference in stdint.h and inttypes.h

    Tim Rentsch, Apr 1, 2012, in forum: C Programming
    Replies:
    6
    Views:
    473
    Tim Rentsch
    Apr 5, 2012
Loading...

Share This Page