CrazyEngineers
  • stdio.h

    stdio.h stands for standard input-output header in C programming. This header file contains definitions for functions like printf(), scanf(), getchar(), putchar(), etc., which are standard input/output library functions in C.

    Here is an example of stdio.h usage:

    #include int main() { int number; printf("Enter a number: "); scanf("%d", &number); printf("You entered: %d", number); return 0; }

    In the above code, stdio.h is included at the top which allows the use of printf() for output and scanf() for input.

    conio.h

    conio.h stands for console input-output. This header file is specific to the DOS operating system and contains functions for console input/output operations. It's not part of the C standard library, so its use is generally discouraged due to its non-portable nature. It includes functions like getch(), clrscr(), kbhit(), etc.

    Here is an example of conio.h usage:

    #include int main() { char ch; printf("Press a key to continue..."); ch = getch(); // Waits for a key press return 0; }

    In the above code, getch() is a function from conio.h which waits for the user to press a key.

    Differences between stdio.h and conio.h

    1. stdio.h is a standard C library for input/output operations while conio.h is specific to DOS and is used for console I/O operations.
    2. stdio.h is portable across different platforms whereas conio.h is not portable and mostly not present in modern compilers like GCC.
    3. The stdio.h library provides functions like printf(), scanf(), fopen(), fclose(), etc. which are universally recognized, while conio.h provides functions like clrscr(), getch(), kbhit(), which are not universally recognized.
    4. conio.h has functions that can be used for changing text color, moving the cursor, etc. These functionalities are not provided by stdio.h.
    5. Functions provided by conio.h are generally faster than stdio.h because they don't perform buffering of input/output operations.

    It's important to note that because conio.h is not part of the standard C library, using it can lead to code that only works on certain systems or compilers. For this reason, many programmers avoid using conio.h and stick to the standard C library functions for input/output.

    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • PROSENJIT

    MemberSep 9, 2015

    Akhil Vijay
    Can anyone please let me know the difference between stdio.h & conio.h and where & when these header files should be used?
    You write [HASHTAG]#include[/HASHTAG]<stdio.h> and [HASHTAG]#include[/HASHTAG]<conio.h> in a C or C++ program to "include" the files "stdio.h" or "conio.h" into your program. It's the same as opening those files in an editor, and copy/pasting them into your program at the point where the [HASHTAG]#include[/HASHTAG] statement is.
    <stdio.h> contain some functions prototypes like printf(), scanf(), cout,cin.
    <conio.h> contain some functions prototypes like clrscr(), getch(), getche() etc.
    To find these files, look in the compiler's install directory, in the lib sub-directory. Just don't change anything in these directories, because they are a part of the compiler and run-time library. 😀
    Are you sure? This action cannot be undone.
    Cancel
  • Akhil Vijay

    MemberSep 9, 2015

    PROSENJIT
    You write [HASHTAG]#include[/HASHTAG]<stdio.h> and [HASHTAG]#include[/HASHTAG]<conio.h> in a C or C++ program to "include" the files "stdio.h" or "conio.h" into your program. It's the same as opening those files in an editor, and copy/pasting them into your program at the point where the [HASHTAG]#include[/HASHTAG] statement is.
    <stdio.h> contain some functions prototypes like printf(), scanf(), cout,cin.
    <conio.h> contain some functions prototypes like clrscr(), getch(), getche() etc.
    To find these files, look in the compiler's install directory, in the lib sub-directory. Just don't change anything in these directories, because they are a part of the compiler and run-time library. 😀
    Thank you very much. Is it necessary to use both the header files in every program that we do?
    Are you sure? This action cannot be undone.
    Cancel
  • Sanyam Khurana

    MemberSep 9, 2015

    Akhil Vijay
    Can anyone please let me know the difference between stdio.h & conio.h and where & when these header files should be used?
    STDIO means Standard Input Output. It has some pre-defined functions like int printf(), scanf() etc. CONIO stands for Console Input Output which has some functions like clrscr(), getch() etc.

    Akhil Vijay
    Thank you very much. Is it necessary to use both the header files in every program that we do?
    conio.h header file isn't used anymore. It was used in old Turbo C compiler which are 16-bit and all your programs run virtually on 8086 microprocessor. So, if you understand how the memory is divided in 8086, you will un-leash must of the logic C uses internally.

    Do not use Turbo C, use gcc or something that uses wrapper to gcc like CodeBlocks IDE.

    Also, your header files should not be placed like:
    [HASHTAG]#include[/HASHTAG]<stdio.h>
    [HASHTAG]#include[/HASHTAG]<conio.h>

    // rest of the program

    The proper way to do this would be:

    [HASHTAG]#include[/HASHTAG]<stdio>

    using namespace std;

    // rest of the program.

    I hope this would be a good pointer for you.
    Are you sure? This action cannot be undone.
    Cancel
  • Akhil Vijay

    MemberSep 9, 2015

    Sanyam Khurana
    STDIO means Standard Input Output. It has some pre-defined functions like int printf(), scanf() etc. CONIO stands for Console Input Output which has some functions like clrscr(), getch() etc.


    conio.h header file isn't used anymore. It was used in old Turbo C compiler which are 16-bit and all your programs run virtually on 8086 microprocessor. So, if you understand how the memory is divided in 8086, you will un-leash must of the logic C uses internally.

    Do not use Turbo C, use gcc or something that uses wrapper to gcc like CodeBlocks IDE.

    Also, your header files should not be placed like:
    [HASHTAG]#include[/HASHTAG]<stdio.h>
    [HASHTAG]#include[/HASHTAG]<conio.h>

    // rest of the program

    The proper way to do this would be:

    [HASHTAG]#include[/HASHTAG]<stdio>

    using namespace std;

    // rest of the program.

    I hope this would be a good pointer for you.
    Sanyam Khurana
    STDIO means Standard Input Output. It has some pre-defined functions like int printf(), scanf() etc. CONIO stands for Console Input Output which has some functions like clrscr(), getch() etc.


    conio.h header file isn't used anymore. It was used in old Turbo C compiler which are 16-bit and all your programs run virtually on 8086 microprocessor. So, if you understand how the memory is divided in 8086, you will un-leash must of the logic C uses internally.

    Do not use Turbo C, use gcc or something that uses wrapper to gcc like CodeBlocks IDE.

    Also, your header files should not be placed like:
    [HASHTAG]#include[/HASHTAG]<stdio.h>
    [HASHTAG]#include[/HASHTAG]<conio.h>

    // rest of the program

    The proper way to do this would be:

    [HASHTAG]#include[/HASHTAG]<stdio>

    using namespace std;

    // rest of the program.

    I hope this would be a good pointer for you.
    Thank you very much for the info.
    Are you sure? This action cannot be undone.
    Cancel
  • pratap singh, upendra

    MemberSep 10, 2015

    Sanyam Khurana
    STDIO means Standard Input Output. It has some pre-defined functions like int printf(), scanf() etc. CONIO stands for Console Input Output which has some functions like clrscr(), getch() etc.
    Could you please shed some light on the difference between Standard Input Output and Console Input Output?
    Just give the striking difference between them. Technical details are not required as of now.
    Are you sure? This action cannot be undone.
    Cancel
  • pratap singh, upendra

    MemberSep 10, 2015

    PROSENJIT
    To find these files, look in the compiler's install directory, in the lib sub-directory. Just don't change anything in these directories, because they are a part of the compiler and run-time library
    Are header files really a part of compiler?

    As per my knowledge, they are a part of run-time library where the developers have written codes that could be used by the programmers instead of reinventing the wheel.
    Correct me if I am wrong...
    Are you sure? This action cannot be undone.
    Cancel
  • Suresh Babu

    MemberJan 23, 2017

    stdio.h is part of c language standard library header. conio.h is an additional library header file provided by BORLAND TURBO C. There are some common functions between these two libraries.
    Are you sure? This action cannot be undone.
    Cancel
  • rajmanisha

    MemberJul 7, 2017

    stdio.h is the header of c programming language which means Standard input output. It has pre-defined functions like int printf(), scanf() etc. conio.h is Console Input Output which include functions like clrscr(), getch() etc.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register