User Tools

Site Tools


user:kkrauss1:portfolio:signal_tester_1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
user:kkrauss1:portfolio:signal_tester_1 [2011/12/12 21:30] – [Systems programming] kkrauss1user:kkrauss1:portfolio:signal_tester_1 [2011/12/12 21:34] (current) – [Project: Signal tester # 1] kkrauss1
Line 1: Line 1:
 +======Project: Signal tester======
  
 +A project for C/C++, Data Structures, and System Programming by Karl Krauss for fall 2011.
 +
 +This did not take long at all, it was just my attempt at playing with signals. 
 +
 +=====Objectives=====
 +The purpose of this project was to create a program to play with signals
 +
 +
 +=====Background=====
 +
 +I had never played with signals before, Matt lectured and we wrote a basic program, I wanted to continue and wrote a couple of my own.  
 +
 +=====Attributes=====
 +
 +====Cprog attributes====
 +
 +  * variables
 +  * pointers 
 +  * i/o 
 +  * functions 
 +  * arrays
 +
 +====Systems programming====
 +  * Signals
 +
 +=====Code=====
 +This is the code:
 +<code c>
 +#include <signal.h>
 +#include <stdio.h>
 +
 +void intu();
 +void seg();
 +void recurse();
 +
 +int main()
 +{
 +    char *array;
 + signal(SIGINT, intu); //interrupt aka ctrl c
 + signal(SIGSEGV, seg);// good ol seg fault why is it V instead of F?
 + getchar();
 + printf("%c\n", *array);
 + return 0;
 +}
 +
 +void intu()
 +{
 + printf("You tried to interrupt me but I won't let you!\n");
 +}
 +
 +void seg()
 +{
 + printf("I segmented!\n");
 +
 +}
 +void recurse()
 +{
 + recurse();
 +
 +</code>