VOOZH about

URL: https://www.geeksforgeeks.org/c/non-standard-input-output-functions-in-c/

⇱ Non-Standard I/O Functions in C - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Non-Standard I/O Functions in C

Last Updated : 2 Aug, 2025

The non-standard functions may not come bundled with every C compiler. We may need to install the relevant library manually to use them. Following are some commonly used non-standard Input and Output function in C:

1. getch() and getche()

These functions are the part of conio.h library for windows. They are used to read a single character from the keyboard without waiting for a newline.

Syntax

This function does not take any parameters. It returns the ASCII value of the pressed key (as an int). The getch() function does not echo the character to the console, while getche() does.

Example


Output

Press a key (not echoed): 
You pressed: E
Press a key (echoed):
E
You pressed:E

2. kbhit

The kbhit() function checks if a key has been pressed without blocking. It is also the part of conio.h header file.

Syntax

This function does not take any parameter and return a non-zero if a key is available, zero otherwise.

Example


Output

Press any key to continue, or wait...
Waiting...
Waiting...
Key pressed: f

3. clrscr()

Also the part of conio.h library, this function is used to clear the console screen. It is exclusive to windows systems.

Syntax

This function neither take any parameter nor returns any value.

Example


Output (Before clrscr())

Screen will clear in 2 seconds...

Output (After 2 seconds)

Screen Cleared

4. gets_s()

The gets_s() is a safer alternative to the deprecated gets, reading a line into a buffer with a size limit. It is optional and is defined inside stdio.h header file if defined.

Syntax

where,

  • buff: string buffer where input is stored.
  • size: Number of characters to read.

Example


Output

This is input string for testing
Read: This is input string
Comment
Article Tags: