Originally Posted by
r00t
im using mingw in windows so it is ctrl+c... if i were using unix cmd it would be ctrl+d..
RockyMarrone, i want to get input of strings(line by line) until the user hits ctrl+c, and then sort it like unix sort
example:
>program.exe
>aaaa
>bbbb
>dddd
>cccc
>eeee
>^C
aaaa
bbbb
cccc
dddd
eeee
hmm dude then if you are linux then you have to catch the singals
i can give you example like
check this out
Code:
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
void exit_program(int sig) {
printf("Wake up call ... !!! - Catched signal: %d ... !!\n", sig);
(void) signal(SIGINT, SIG_DFL);
}
int main(void) {
(void) signal(SIGINT, exit_program);
while(1)
printf("I wanna catch Ctrl + C\n"), sleep(1);
return 0;
}