home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18318 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.2 KB  |  36 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!gatech!darwin.sura.net!udel!rochester!rit!cci632!dwr
  3. From: dwr@cci632.cci.com (Donald W. Rouse II)
  4. Subject: Re: File protection on iostreams
  5. Message-ID: <1992Dec22.180556.23254@cci632.cci.com>
  6. Organization: [Computer Consoles, Inc., Rochester, NY
  7. References: <1992Dec15.212053.4733@pixel.kodak.com>
  8. Date: Tue, 22 Dec 1992 18:05:56 GMT
  9. Lines: 25
  10.  
  11. In article <1992Dec15.212053.4733@pixel.kodak.com> morss@ssd.kodak.com (Charlie Morss) writes:
  12. >
  13. >According to Strus. the header files for fstream.h in the
  14. >third arguement for the open call specifies the
  15. >file protection mode, as in chmod, for the file
  16. >you are creating. When I use a protection mode of
  17. >664, when the file is created it has a protection
  18. >mode of 644, which is the default. Is there a 
  19. >reason that the file protection mode is not
  20. >done correctly.
  21.  
  22. Yes.  Look at umask(2) and open(2) in your reference manual
  23. to see how they interact.
  24. Use the umask(1) command to examine or change your umask,
  25. or, in the program, you can do something like:
  26.  
  27.     int oldumask = umask (0);
  28.     // do your open
  29.     (void)umask (oldumask);
  30.  
  31. [...]
  32. >P.P.S. If I do "normal" opens (old fashion C) 
  33. >       everything works fine!!
  34.  
  35. Are you sure about this?  It should suffer from the same problem.
  36.