home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18021 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.7 KB  |  57 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!usc!rpi!newsserver.pixel.kodak.com!morss
  3. From: morss@ssd.kodak.com (Charlie Morss)
  4. Subject: File protection on iostreams
  5. Message-ID: <1992Dec15.212053.4733@pixel.kodak.com>
  6. Sender: morss@eksignal.kodak.com
  7. Organization: Ektron, a division of Eastman Kodak, Co.
  8. Date: Tue, 15 Dec 92 21:20:53 GMT
  9. Lines: 46
  10.  
  11.  
  12. According to Strus. the header files for fstream.h in the
  13. third arguement for the open call specifies the
  14. file protection mode, as in chmod, for the file
  15. you are creating. When I use a protection mode of
  16. 664, when the file is created it has a protection
  17. mode of 644, which is the default. Is there a 
  18. reason that the file protection mode is not
  19. done correctly. Here is an example:
  20.  
  21. #include "fstream.h"
  22.  
  23. fstream filestream;
  24. int     iosmode = ios::out|ios::noreplace;
  25.  
  26. filestream.open("file.ext",iosmode,0664);
  27. ...
  28.  
  29. The file "file.ext" does not get created with
  30. protection 664, it gets created with 644.
  31.  
  32. If I do fchmod(descp,0664) the protection
  33. is changed to what I want. But I shouldn't
  34. have to do this!
  35.  
  36.  
  37. Also, even if I get the file created correctly
  38. I have troubles opening the file under a different
  39. user name who is in the same group. The open just
  40. fails as if the protection is wrong. (If the protection
  41. is manually changed to 666 it opens fine).
  42.  
  43. What am I missing here?
  44. Please help!!!
  45.  
  46. Charlie 
  47.  
  48. P.S. Sun Sparc II w/ Sun OS 4.1.1 and Sun C++
  49.     
  50. P.P.S. If I do "normal" opens (old fashion C) 
  51.        everything works fine!!
  52. -- 
  53. -----------------------------------------------------------------
  54. Charlie Morss                               Voice: (716) 726-5461
  55. morss@eksignal.kodak.com                      Fax: (716) 726-4850 
  56. -----------------------------------------------------------------
  57.