How can I break out of this loop?
while(1){
//continuously blink an led
//stop when user hits CTRL+D
}
//do other stuff
I tried while(fgets(s, BUFSIZ, stdin) != NULL)
, but of course it will wait for user input before continuing. I want the code inside the loop to run continuously, and break only the user hits CTRL+D
.
I've done this at a low level with interrupts, but no clue how to do it in a high level environment.
Platform is Raspbian (Kernel 3.10) on Raspberry Pi