Re: Can I detect "enter" key using scanf?

Discussion in 'C Programming' started by Ben Pfaff, Aug 5, 2003.

  1. Ben Pfaff

    Ben Pfaff Guest

    (Abby) writes:

    > I would like to detect if user type nothing and just press enter, my
    > program will assign "toyota" as the default value. With above code,
    > when I press enter with NULL value, the program will go no where. It
    > still waiting for me to type something. How can I get through this?


    Use fgets().
    --
    "...what folly I commit, I dedicate to you."
    --William Shakespeare, _Troilus and Cressida_
     
    Ben Pfaff, Aug 5, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Pop

    Re: Can I detect "enter" key using scanf?

    Dan Pop, Aug 6, 2003, in forum: C Programming
    Replies:
    0
    Views:
    1,587
    Dan Pop
    Aug 6, 2003
  2. bd
    Replies:
    0
    Views:
    1,696
  3. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    446
    Anders Matthiessen
    Jan 12, 2005
  4. M P
    Replies:
    1
    Views:
    556
  5. HopfZ
    Replies:
    0
    Views:
    629
    HopfZ
    Aug 28, 2006
Loading...

Share This Page