Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "stdlib.h"
- #include "time.h"
- int main(int argc, char** args){
- srand( time( NULL ) );
- if(argc < 3){
- printf("Złe uzycie programu, podaj 3 parametry");
- return -1;
- }
- float t = (float)atof(args[0]);
- char* s = args[1];
- int d = atoi(args[2]);
- struct timespec ts;
- ts.tv_sec = (int)t;
- ts.tv_nsec = (t - (int)t) * 1000000000;
- while(1){
- nanosleep(&ts, NULL);
- write(d, s, strlen(args[1]);
- if(rand()%2 == 0){
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement