473,395 Members | 1,348 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,395 software developers and data experts.

getch should have a prototype

Expand|Select|Wrap|Line Numbers
  1. #include<sdio.h>
  2. #define g gotoxy 
  3. #define p printf
  4. #define s scanf
  5. main()
  6. {
  7. int ctr;
  8. clrscr();
  9. ctr=1;
  10. while(ctr<=5)
  11. {
  12. p("\n Hello");
  13. ctr++;
  14. }
  15. getch();
  16. }
  17.  
please help me. my error is in getch and in clrscr
Mar 22 '11 #1

✓ answered by weaknessforcats

You need to include conio.h to get the getch prototype. You may need to use _getch since the name getch is deprecated.

clrscr is non-standard. I recommend you use the system function:

Expand|Select|Wrap|Line Numbers
  1. system("cls");
You will need to include <stdlib.h> to use the system function

2 32542
donbock
2,426 Expert 2GB
getch and clrscr are not part of the C Standard Library. Where do this functions come from? You should have gotten a header file from whereever those functions came from.
Mar 22 '11 #2
weaknessforcats
9,208 Expert Mod 8TB
You need to include conio.h to get the getch prototype. You may need to use _getch since the name getch is deprecated.

clrscr is non-standard. I recommend you use the system function:

Expand|Select|Wrap|Line Numbers
  1. system("cls");
You will need to include <stdlib.h> to use the system function
Mar 22 '11 #3

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

Similar topics

3
by: voidstar | last post by:
Hi, I have the following problem: I use "getch" to monitor keypresses and the I use "cin" to input a string. When I type in 'y', the 'y' character appears, so I need to hit backspace before...
6
by: libsfan01 | last post by:
Hi all Im trying to use prototype for an xmlhttprequest, but it doesn't seem to be working cross-browser. Is there someway of getting it to be IE6 compatible (active x)? here's my code so...
5
by: Sankar | last post by:
Dear all, In my programming snippet compiled in Linux 2.6, I have a getch() , but the program when executed does not wait for my input.. fflush(stdin), fflush(stdout) - All these did not help. ...
10
by: sicba2222 | last post by:
Hi all, I am new to C++...I tried to compile the following program... #include<iostream.h> #include<conio.h> #include<string> #include<stdio.h> int main() {
16
by: fuzhen | last post by:
If I want to "press any key to continue" in Windows, I can use getch() But the getch() isn't a standard C function So what should I to do in Linux?
6
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
1
by: cppcompiler1000 | last post by:
i have got an error how can i correct it. "the function getch() should have a prototype" #include<iostream.h> #include<string.h> class employee { char name; public: void putname(char *n);
2
by: omer awan | last post by:
it generates one error plz check urgent? // PROJECT ON HOTEL MANAGEMENT # include <iostream.h> # include <conio.h> # include <dos.h> # include <iomanip.h> # include <GRAPHICS.H> # include...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.