Thread: problem with gets()

  1. #1
    steve8820
    Guest

    Question problem with gets()

    I am having a strange problem when prompting the user for input. When I try to use gets() it seems to skip over a piece of my code. For example:

    char in_line[100];

    cout<<"Enter your string: ";
    gets(in_line);


    If I used this code if would not print Enter your string. It would simply skip over it and wait for user input. I am very confused to why this is happening. If anyone has any ideas please help. Thanks

  2. #2
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    have you tried
    Code:
     cin.getline(data,x)
    . i think it's in <ctype.h>. but I don't know much, i'm learning myself.

  3. #3
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    strange.. i used to have the same problem while using
    cin.getline(), thus i changed to gets().

    maybe use : cin.ignore();
    -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 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