You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
392 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <fcntl.h>
  4. #include <unistd.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. int main() {
  8. printf("SUBSCRIBER\n");
  9. int fd = open("/tmp/ex1", O_RDONLY);
  10. if (fd == -1) {
  11. perror("open");
  12. exit(1);
  13. }
  14. char mes[1024];
  15. while(1) {
  16. read(fd, mes, 1024);
  17. printf("%s", mes);
  18. sleep(1);
  19. }
  20. }