I cant use scanf() because to receive integer input you need to press ENTER (when you are running the program).
            Asked
            
        
        
            Active
            
        
            Viewed 2,080 times
        
    1
            
            
        - 
                    I need answer really fast so please help me with that thing – happymancer Dec 27 '16 at 12:09
- 
                    BTW i need to get from the users 4 digits in the same row like 4563 end then the program should continue without waiting for the user to press enter (if someone got my question wrong i hope that this comment will help) – happymancer Dec 27 '16 at 13:41
- 
                    thx guys but finally i thought about using getch with the ascii table XD – happymancer Dec 27 '16 at 15:08
2 Answers
0
            
            
        Use curses library and use getch function to read a key without pressing enter. This works on linux and i think you can also use it on windows
 
    
    
        baliman
        
- 588
- 2
- 8
- 27
- 
                    
- 
                    
- 
                    I did not ask the question, also what's the advantage over `getchar` from stdio? – frostblue Dec 27 '16 at 12:22
- 
                    @saeleko `getchar`, just like `scanf`, reads from stdin which is line-buffered by default on most terminals. There's no standard function to change this behaviour, but curses is a good choice for its portability. – Quentin Dec 27 '16 at 13:30
- 
                    @Quentin ah right, I was aware of scanf being buffered, not getchar. Thanks – frostblue Dec 27 '16 at 14:47
0
            
            
        If you are in Windows, then use getch() from conio.h If you are in Unix/Linux.. you will probably need some terminal/tty adjustments. Check here:
 
     
    