Thread: stdio.h or cstdio.h ?

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    84

    stdio.h or cstdio.h ?

    Hi guys,

    I know that in C++ we don't add .h after the include file, to work with the stanard library.

    How doe's it work in C?
    Should I include:

    stdio.h
    cstdio.h
    stdio ??
    or soething else ...


    Many thanks

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    C++ removes the .h and prefixes c. So cstdio in C++ would be stdio.h in C.
    My best code is written with the delete key.

  3. #3
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    If you're working in C++ include <cstdio> to use the C stream library. There really isn't a reason to do this I think apart from special circumstances or the flawed belief that C line-buffered I/O is faster than C++'s line-buffered I/O.

    If you're working in C, the library is <stdio.h>

    When C++ adapted C's standard library, the older header files were renamed using an initial c and no extensions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stdio.h cstdio.h
    By salvadoravi in forum C Programming
    Replies: 3
    Last Post: 01-21-2008, 03:00 PM
  2. error: stdio.h: No such file or directory
    By MindLess in forum C Programming
    Replies: 9
    Last Post: 12-20-2007, 08:11 AM
  3. stdio.h
    By Vertex34 in forum C Programming
    Replies: 2
    Last Post: 07-12-2004, 10:18 AM
  4. error in -stdio.h __VALIST
    By JaWiB in forum C++ Programming
    Replies: 3
    Last Post: 09-20-2003, 12:22 PM
  5. Modifying stdio.h
    By Spectrum48k in forum C Programming
    Replies: 10
    Last Post: 05-29-2002, 08:30 AM