home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!usc!rpi!newsserver.pixel.kodak.com!morss
- From: morss@ssd.kodak.com (Charlie Morss)
- Subject: File protection on iostreams
- Message-ID: <1992Dec15.212053.4733@pixel.kodak.com>
- Sender: morss@eksignal.kodak.com
- Organization: Ektron, a division of Eastman Kodak, Co.
- Date: Tue, 15 Dec 92 21:20:53 GMT
- Lines: 46
-
-
- According to Strus. the header files for fstream.h in the
- third arguement for the open call specifies the
- file protection mode, as in chmod, for the file
- you are creating. When I use a protection mode of
- 664, when the file is created it has a protection
- mode of 644, which is the default. Is there a
- reason that the file protection mode is not
- done correctly. Here is an example:
-
- #include "fstream.h"
-
- fstream filestream;
- int iosmode = ios::out|ios::noreplace;
-
- filestream.open("file.ext",iosmode,0664);
- ...
-
- The file "file.ext" does not get created with
- protection 664, it gets created with 644.
-
- If I do fchmod(descp,0664) the protection
- is changed to what I want. But I shouldn't
- have to do this!
-
-
- Also, even if I get the file created correctly
- I have troubles opening the file under a different
- user name who is in the same group. The open just
- fails as if the protection is wrong. (If the protection
- is manually changed to 666 it opens fine).
-
- What am I missing here?
- Please help!!!
-
- Charlie
-
- P.S. Sun Sparc II w/ Sun OS 4.1.1 and Sun C++
-
- P.P.S. If I do "normal" opens (old fashion C)
- everything works fine!!
- --
- -----------------------------------------------------------------
- Charlie Morss Voice: (716) 726-5461
- morss@eksignal.kodak.com Fax: (716) 726-4850
- -----------------------------------------------------------------
-