Hi Michael, On Mon, Oct 04, 2010 at 11:18:32AM -0400, Michael Gong wrote: > Hi, > > Following code is compiled and run fine on Solaris by SunStudio: > > #include <fstream.h> > int main() { > ofstream errorLog; > errorLog.open("mylog.test", ios::out, 0666); //0666 seems set the file permission > return 0; > } > > But g++ failed to compile it by complaining not finding the matched method. > > My question is whether C++ standard library allows the extra parameter > in the open method to set the file permission. > > I googled it and the answer seems to be "no", but hope someone could confirm it. I believe also "no" -- and the C++-Standard also does not mention this parameter in the definition of basic_ofstream (§27.8.1.8). Beside that: A file permission mode is (in principle) not platform-independent, but does heavily depend on the platform -- it would be surprised if that would be offered by the standard library. If you need to do it, use e.g. on Linux the C-function "int chmod(const char *path, mode_t mode);" defined in <sys/stat.h> HTH, Axel