Thread: Exit when ctrl+d is pressed

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    14

    Exit when ctrl+d is pressed

    Im writing a shell in c right now and one the things I need to do is have it exit when ctrl+d is pressed. How would I do this? What does ctrl+d stand for? I have no idea where to look.

    Any help would be much appreciated.

  2. #2
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    I assume you are working on a UNIX/like platform, in which case, CTRL+D is a signal called the "Hangup" passed to the process, when the user presses CTRL+D on this working process.
    To trap this information, you can use the signal() function call, to install a handler for this signal.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Chat Program Help?
    By Paul22000 in forum Networking/Device Communication
    Replies: 9
    Last Post: 02-10-2009, 12:35 AM
  2. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 12:56 AM
  3. Replies: 1
    Last Post: 03-21-2006, 07:52 AM
  4. Dynamic array of pointers
    By csisz3r in forum C Programming
    Replies: 8
    Last Post: 09-25-2005, 02:06 PM
  5. exit() ?
    By smd in forum C++ Programming
    Replies: 4
    Last Post: 06-26-2002, 04:31 PM