Thread: What Does This Do?

  1. #1
    Question
    Guest

    Question What Does This Do?

    Could some1 tell me what this program exactly does? Iv compiled and run it but cant seem to work out what exactly it does


    #include <signalh>
    #include <stdio.h>
    #include <unistd.h>

    void ouch(int sig)
    {
    printf("OUCH! ? I got signal %d\n, sig);
    }

    main()
    {
    signal(SIGINT, ouch);
    while(1)
    {
    printf("Hello world\n");
    sleep(1);
    }
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Signal usage. Signal descriptions.

    Basicly, it waits for an interrupt from the keyboard, and then it calls the function.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Question
    Guest
    What is the point of the program, what would it be used for, I just dont see what the point of it is or what it would be used 4

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >What is the point of the program, what would it be used for
    Probably as a bad example of signal handling.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed