Stopping input with CTRL+D
I'm trying to write a program in linux that will allow me to enter a word then a space then a number. Then after I hit enter it will let me do this again and again. Now I need to be able to stop this so I want it to stop taking input and do some processing when I hit CTRL+D. Something like this:
joe 30
bob 40
jill 20
(CTRL+D pressed)
(now do stuff with the data just entered)
But I can't seem to get it to work without getting a core dump. BTW im writing this in C not C++. Any one know how I can do this? I sorry I don't have the code I have, I left it on another computer that I can't access right now. Thanks for any suggestions. I'm rather new at linux developing.