Page 1 of 1

conio.h: No such file or directory

Posted: Fri Aug 01, 2003 2:26 pm
by Morning
I wanna use the getch() function,but the judge system said that "01767330_24.c:4:19: conio.h: No such file or directory".
Please tell me how to solve the problem if u know.Thank u!

Posted: Fri Aug 01, 2003 3:40 pm
by Viktoras Jucikas
getch() is Borland compiler specific function (non ISO). conio.h header is also present only in Borland products, thus judge system (which is GNU GCC suite) does not have them. Try using scanf()/printf() family or iostreams instead.

Posted: Fri Aug 01, 2003 3:48 pm
by Morning
Thank U Very Much!!!

Posted: Fri Aug 01, 2003 4:45 pm
by Ivor
you can user getchar() or fgetc()

Ivor

Posted: Sat Aug 02, 2003 2:02 pm
by Morning
Thank u!Ivor! :D

Posted: Sat Aug 02, 2003 4:54 pm
by Morning
I wonder if there's a function that exactly like getch()?
fuction such as cin.get(),getchar() will wait for "enter".Is there a function that will reflect immediately when i input a simple character?

Posted: Sat Aug 02, 2003 5:16 pm
by Ivor
it does wait for a newline in case you are inputting from console. In case your standard input is redirected from a file then it will get you next character without any problems. <conio> functions are especially done for console io, to add functionality. getchar waits for enter because so you can change entered data. But with redirected standard input it will simply use line buffering. It will internally buffer till a newline. And will give you requested character without any delay.

Ivor

P.S. When I solve problems I always use redirected input. A lot more silmpler.