473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

confuse

hello friends!
would you plz explain in details about getc,getchar(),getch(),getche .how these are important in c.
Aug 1 '07 #1
2 1216
r035198x
13,262 8TB
hello friends!
would you plz explain in details about getc,getchar(),getch(),getche .how these are important in c.
Moved to C++ forum
Aug 1 '07 #2
hello friends!
would you plz explain in details about getc,getchar(),getch(),getche .how these are important in c.
prototype of getc is
int getc ( FILE * stream );
To identify whether end of file encoutered etc by the int value returned.

prototype of getchar is
int getchar ( void );
Returns next character from standard input.


getchar
This is a standard function that gets a character from the stdin.

getch
This is a nonstandard function that gets a character from keyboard, does not echo to screen.

getche
This is a nonstandard function that gets a character from the keyboard, echoes to screen. You need not press Enter key after pressing the character

Use getchar if you want it to work on all compilers. Use getch or getche on a system that supports it when you want keyboard input without pressing [Enter].

And note that the return value of all are int! You need this to properly check for EOF

Regards,
Girish.
Aug 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: iceColdFire | last post by:
Hi, Last night I was trying to work on a project requiring lots of timer controls...I needed good ANSI based API's for milliseonds and other stuff... However , google on time funcitons in c++,...
3
by: ambar.shome | last post by:
i have a function as listed below: char* ltoa(char* chr) { char* myChr=new char; strcpy(myChr,chr); return myChr; } in the above code i am returning a reference or pointer to a local
2
by: NomoreSpam4Me | last post by:
Hi, right now i have a database that calcul attendance time. I have a qry with Date, EmployeeName, EmployeeID, PayCodeName, TimeInSecond. In the PayCodeName there is multiple thing, like,...
7
by: key9 | last post by:
Hi ALL. Basic Question. sample: class MyClass { ....
4
by: key9 | last post by:
Hi All simple question: 1.==================================== { int* p_1 = new int(); }; //will p1 leak?
4
by: XHengDF | last post by:
#include "iostream" struct C { template <typename T> void foo(){} }; int main() { std::cout << typeid( (&C::foo<int>) ).name() << std::endl; } output: int
0
by: key9 | last post by:
Hi All Scene: I am making a toy for myself. with a "serial port" to control. A console based program running on pc control it.(under c++) On design, I met these c++ problem: 1.Is there...
5
by: Nor farhana yaakub | last post by:
i dun know how to 1. Write a program that uses a do-while loop to print the even numbers between 2 and 60, inclusive, each on a new line. 2. Write a program that asks the user to enter a number...
0
by: infotechsys | last post by:
When I run this code in the pdb it works. accountNbr = 1 for testLine in ftest.readlines(): acct = testLine #there account number if accountNbr == int(acct): accountNbr = accountNbr...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.