home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / minix / 5265 < prev    next >
Encoding:
Text File  |  1993-01-25  |  961 b   |  46 lines

  1. Newsgroups: comp.os.minix
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!yale!gumby!wmu-coyote!ishwar
  3. From: ishwar@sol.cs.wmich.edu (Ishwar Rattan)
  4. Subject: help with <fcntl.h> in Minix 1.5
  5. Message-ID: <1993Jan26.003907.723@sol.cs.wmich.edu>
  6. Followup-To: ishwar@cs.wmich.edu
  7. Keywords: <fcntl.h> file, Minix 1.5, header file errors
  8. Organization: Western Michigan Univ. Comp. Sci. Dept.
  9. Date: Tue, 26 Jan 1993 00:39:07 GMT
  10. Lines: 34
  11.  
  12. hello
  13.  
  14.    i wrote this c-program with <fcntl.h> header file using
  15. out of the box Minix 1.5. when compiled with cc, it gives errors
  16. in the header file!? any ideas / help will be apprecaited.
  17.  
  18. - ishwar
  19. ------
  20. #include <stdio.h>
  21. #include <fcntl.h>
  22.  
  23. main()
  24. {
  25.   char ch;
  26.   int fin;
  27.  
  28.   if((fin = open("junk", O_RDONLY)) < 0)
  29.     xit("open failed.");
  30.   while(read(fin, &ch, 1))
  31.     putchar(ch);
  32.  
  33.   if(close(fin) < 0)
  34.     xit("close failed.");
  35.  
  36.   exit(0);
  37. }
  38.  
  39. xit(reason)
  40. char *reason;
  41. {
  42.   fprintf(stderr, "%s\n", reason);
  43.   exit(1);
  44. }
  45. -------
  46.