This shows you the differences between two versions of the page.
user:kkrauss1:portfolio:mod_data [2011/12/12 22:04] – created kkrauss1 | user:kkrauss1:portfolio:mod_data [2011/12/12 22:05] (current) – [Data Structures] kkrauss1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Project: | ||
+ | A project for C/C++, Data Structures, and System Programming by Karl Krauss for fall 2011. | ||
+ | |||
+ | This program only took about an hour. | ||
+ | |||
+ | =====Objectives===== | ||
+ | The purpose of this project was to modify a program to work with processes using c. | ||
+ | |||
+ | |||
+ | =====Attributes===== | ||
+ | |||
+ | |||
+ | ====Data Structures==== | ||
+ | * Pointers | ||
+ | * sorts | ||
+ | |||
+ | |||
+ | ====Systems programming==== | ||
+ | * processes | ||
+ | * command line arg | ||
+ | * timers | ||
+ | * io redirection | ||
+ | |||
+ | =====Code===== | ||
+ | This is the header file: | ||
+ | <code c> | ||
+ | * | ||
+ | */ | ||
+ | # | ||
+ | # | ||
+ | //# | ||
+ | //# | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | #define DINGLEHOPPER | ||
+ | #define SNARFBLAT | ||
+ | |||
+ | int main(int argc, char **argv) | ||
+ | { | ||
+ | int i = 0, *status; | ||
+ | pid_t me; | ||
+ | |||
+ | me = getpid(); | ||
+ | |||
+ | if (argc < 2) | ||
+ | { | ||
+ | //std :: cout << " | ||
+ | printf(" | ||
+ | exit(1); | ||
+ | } | ||
+ | |||
+ | for(i=1; i<argc; i++) | ||
+ | { | ||
+ | DINGLEHOPPER; | ||
+ | |||
+ | if(getpid() != me) | ||
+ | { | ||
+ | sleep(atoi(argv[i])); | ||
+ | //std :: cout << atoi(argv[i]) << " "; c++ output so removed | ||
+ | printf(" | ||
+ | exit(0); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | for(i=1; i<argc; i++) | ||
+ | SNARFBLAT; | ||
+ | |||
+ | //std :: cout << std :: endl; c++ output so removed | ||
+ | printf(" | ||
+ | |||
+ | return(0); | ||
+ | } | ||
+ | </ |