Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include<stdlib.h>
  2. #include<stdio.h>
  3. #include<string.h>
  4. #include<errno.h>
  5. #include<unistd.h>
  6. void mysyserr(char *mymsg)
  7. {
  8. int dlugosc = strlen(strerror(errno));
  9. char msg[100] = "ERROR: ";
  10. strcat(msg, mymsg);
  11. write(2,msg,strlen(msg));
  12. write(2,strerror(errno),dlugosc);
  13. /*
  14. printf("(erron: %d, %s)\n", errno, strerror(errno));
  15. */
  16. exit(errno);
  17. }
  18.  
  19.  
  20. int main()
  21. {
  22. char buf[128];
  23. int ile;
  24. if((ile = read(77, buf, 128)) == -1)
  25. mysyserr("blad funkcji read ");
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement