September 11th, 2013, 08:19 AM
How can i use getch?
i am unable to use getch and putch.
can i use this with gcc.
September 11th, 2013, 10:34 AM
Those are non-standard functions, meaning that they are not supported by the C Standard Library.
Rather, they come in conio. Just like with any other external function, even standard ones, you need to #include the header file, which in this case would be conio.h. If your copy of gcc does not have that header file, then it does not support conio; look in your compiler's INCLUDE directory.
If you are using MinGW gcc under windows, then in INCLUDE you should also see a source file, conio.c, which implements part of the conio library. You would need to add that source file to your project.
In other versions of gcc, if you have a conio.h header file, then you might have a conio library file in the LIBRARY directory. If that is the case, then you would need to add that library to your project.