printf return value

This is a discussion on printf return value within the C Programming forums, part of the General Programming Boards category; What does the return value of printf represent in C89 and C99? Is it different or not?...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    201

    printf return value

    What does the return value of printf represent in C89 and C99?
    Is it different or not?

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,669
    The integer that printf returns is the number of characters printed minus the terminating zero, or a negative value if an error occurs. The return value didn't change; if it did, the man page would have been updated.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    It's the same, of course. C99 does not contain any such subtle backwards incompatibilities. I don't think it contains any incompatibilities at all.

    printf() returns the number of characters actually written.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 08:38 AM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  4. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 12:26 AM
  5. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 12:54 AM

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