Thread: inputting problem

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    1

    inputting problem

    Code:
    //all headers go here
    
    int main()
    {
       char name[20];
    
       printf("Enter your name : ");
       gets(name); // I replaced using with scanf() too but still have the same problem
       return 0;
    }
    When I ask for a user input like that , sometimes my console doesn't ask for user input and it just directly went to next instruction. Let's say if I run the above program, when printf prompts " Enter your name " then cursor should be next to the word "name" but instead nothing happens and program suddenly stops. What should I do to prevent from that sort of error ??? I tried replacing with scanf() function instead of gets() , but sometimes I still encounter the same problem. Can anyone suggest me what should I do ??? Thanks all in advance.

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with inputting password?
    By Abda92 in forum C Programming
    Replies: 3
    Last Post: 06-01-2008, 01:14 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM