I should have learned all this 4 years ago! All those times i've been using scanf for character input lol.
@paultidwell8799 Жыл бұрын
These days it's sscanf and not scanf too.
@filiperubin4 жыл бұрын
I'm in C++ but you've helped me a lot! Thanks!
@vasusubbannavar57892 жыл бұрын
thanks for the help. and i wanted to ask if there is a function like 'getch' to use across the platform like linux
@HK-sw3vi4 жыл бұрын
that debug hack was the real reason i was here, thanks
@jalalbounaim3 жыл бұрын
why char cannot store -1?(i.e. EOF) signed char has from -128 to + 127. Enough for all the ascii codes and -1 as well. Thanks in advance, love ur videos and ur channel. A gem.
@CodeVault3 жыл бұрын
EOF is not a character and is defined as a signed int in most libraries which is different than the -1 signed char
@phuongnguyen-sb5de3 жыл бұрын
@@CodeVault how can it get EOF when it always prompt you to enter a character?
@CodeVault3 жыл бұрын
@@phuongnguyen-sb5de I think it's usually CTRL + D or CTRL + Z (on Windows)
@matiasalzu39993 жыл бұрын
You always save me, thanks!!!
@SidsAnalysis2 жыл бұрын
Kbhit() and getch() alternatives for other os which not supports ?
@CodeVault2 жыл бұрын
I tried finding something but all alternatives, I think, are platform specific, unfortunately
@SidsAnalysis2 жыл бұрын
@@CodeVault it also fine when found any platform specific alternatives
@CodeVault2 жыл бұрын
@@SidsAnalysis Here is one for Linux for example: stackoverflow.com/questions/7469139/what-is-the-equivalent-to-getch-getche-in-linux
@artukiwi70884 жыл бұрын
Thanks. What does it mean that 'getch' can be used as an macro?
@indibarsarkar39362 жыл бұрын
Thanks for this helpful video. I have a question. Are there any alternatives available if we need to take a single character input from the user without storing it in the buffer (ie. without the need to press the enter key) but also following the standard norms?
@CodeVault2 жыл бұрын
As far as I know it's not possible in a standard way. Here's a good answer on this topic: stackoverflow.com/questions/421860/capture-characters-from-standard-input-without-waiting-for-enter-to-be-pressed
@mb596213 ай бұрын
Hey I hope you are doing well . I am on Linux and getch() does not work . I am writing a program that specifically works on the principle that the user enters the character but is not allowed to see the input he gives . How do I write my own getch() or do you know if there is a substitute for it in the std. c library?
@CodeVault3 ай бұрын
There are actually some good solutions here: stackoverflow.com/questions/3276546/how-to-implement-getch-function-of-c-in-linux
@teachkhmerbinary8 ай бұрын
short video but i know everything
@mortenlund14183 жыл бұрын
You are fabulous - no less!
@user-su5sq5ib3i Жыл бұрын
Can you do a video on the EOF macros? I am stuck on a program in teh ansi c book and cant find valid info on it on youtube.
@ZahinAbdullah2 жыл бұрын
do i have to enter (stdin)??? if i don't... won't the getc func work??
@CodeVault2 жыл бұрын
Yes, you have to hit enter
@d.am1nn Жыл бұрын
thanks man
@jakubsz46022 жыл бұрын
Why do you assign it as int??
@CodeVault2 жыл бұрын
It's what the function's signature returns to account for EOF