Unformatted I/O functions : getch() , getche() , getchar() , fgetchar()
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
printf("\n(using getch) Press any key to continue..");
//character will not be echoed by getch()
getch();
printf("\n(Using getche())Press any key to echo..." );
//character will be echoed by getch()
ch=getche();
printf("\n (Using getchar())Type any character:");
getchar();//macro present in conoio.h
printf("\n(Using fgetchar()) Type another character:(Y/N)");
fgetchar(); //function present in conio.h
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
char ch;
printf("\n(using getch) Press any key to continue..");
//character will not be echoed by getch()
getch();
printf("\n(Using getche())Press any key to echo..." );
//character will be echoed by getch()
ch=getche();
printf("\n (Using getchar())Type any character:");
getchar();//macro present in conoio.h
printf("\n(Using fgetchar()) Type another character:(Y/N)");
fgetchar(); //function present in conio.h
return 0;
}
0 comments: