Thread: stdio.h & conio.h

  1. #1
    Registered User joybanerjee39's Avatar
    Join Date
    Oct 2011
    Location
    kolkata
    Posts
    106

    stdio.h & conio.h

    i am trying to get the concept of stdio.h and conio.h . i have studied that stdio.h contains the prototypes of standard input/output functions (so, stdio) and conio.h contains the prototypes of console input/output. but, i am not getting the concept of standard and console input /output. i mean why standard i/o is called standard and console i/o is called so? what is the actual difference between them? why isn't there only one i/o header file ? and why conio.h is not standard ? i hope i am able to convey my confusion. please help!!

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    This has to do with the history of C ...

    Way back in the beginning, there was no GUI mode, so everything had to be done on console mode (DOS full screen). Early versions of C included special functions for relocating the cursor and changing colours in the console window. As time marched on other functions such as printf() and scanf() were added. Rather than complicate the conio.h library a new one was created to become stdio.h.

    In modern systems console mode is almost never used, favoring OS level GUI modes such as the standard Windows graphical interface. This has increasingly left the console mode to training and certain small utility programs, but otherwise it is unused in today's programs. The original conio.h functionality has been "deprecated" (disfavoured) and is no longer included with many new compilers.

    In truth you don't actually care what the difference is... just so know where the functions you need are.

    Programming languages tend to get tangled up like this over time... someone introduces a new library, older libraries are deprecated... time marches on.

  3. #3
    Registered User joybanerjee39's Avatar
    Join Date
    Oct 2011
    Location
    kolkata
    Posts
    106
    thnx for ur reply

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    That's an interesting read, Tater, but unfortunately is inaccurate.

    stdio.h existed with the first version of C created. conio.h was first introduced with Lattice-C, the first C compiler targeting MS-DOS, to write text-based user interface. Versions of the header (and the associated library) were subsequently shipped with a number of compilers (most notably those by Microsoft and Borland) targeting MS-DOS, windows 3.1, OS/2. Different compiler vendors implemented the functions slightly differently though, so there were minor incompatibilities between programs depending on which compiler they were built with. Later on, some compilers targeting linux, win32, and OS/2 were shipped with a version of conio.h and associated library.

    conio.h never became standard because it makes some rather specific assumptions about the host system (most notably, presence of a keyboard and of a screen or window to which output can be written in arbitrary locations) that make it inherently not portable to systems that don't have those features (such as a lot of embedded systems).
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stdio.h?
    By kiros88 in forum C Programming
    Replies: 5
    Last Post: 05-21-2010, 07:09 PM
  2. stdio.c???
    By DJTurboToJo in forum C Programming
    Replies: 6
    Last Post: 03-26-2008, 01:20 PM
  3. conio vs stdio
    By siavoshkc in forum C++ Programming
    Replies: 6
    Last Post: 01-18-2006, 11:38 PM
  4. stdio.h
    By Vertex34 in forum C Programming
    Replies: 2
    Last Post: 07-12-2004, 10:18 AM
  5. DevC++ accepts neither "conio.h" nor "conio.c"
    By Nutshell in forum C Programming
    Replies: 9
    Last Post: 01-18-2003, 04:35 AM