473,714 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

standard c++ basic_fstream question

I have a C++ code which I want to upgrade to the standard C++

The code constructs a file and sets the file permission
The new iostream library does not include filebuf::openpr ot

The old ofstream constructor (<fstream.h>) accepts a third parameter (int
nProt = filebuf::openpr ot)

i.e. ofstream( const char* szName, int nMode = ios::out, int nProt =
filebuf::openpr ot );

but the standard ofstream constructor (<fstream>) does not accept the third
parameter anymore.
How do I preserve the functionality to set the file permission?

Thanks,
Avner
Oct 15 '05 #1
1 1514
Avner wrote:
I have a C++ code which I want to upgrade to the standard C++

The code constructs a file and sets the file permission
The new iostream library does not include filebuf::openpr ot

The old ofstream constructor (<fstream.h>) accepts a third parameter
(int nProt = filebuf::openpr ot)

i.e. ofstream( const char* szName, int nMode = ios::out, int nProt
= filebuf::openpr ot );

but the standard ofstream constructor (<fstream>) does not accept the
third parameter anymore.
How do I preserve the functionality to set the file permission?


You can't. It doesn't exist in the standard library. You need to
use platform-specific means of working with files.

V
Oct 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1347
by: rlzsmith | last post by:
Does the standard edition have a visual windows forms developer Thanks.
43
4997
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I'm not sure if that's a good thing or not. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with STL, and you can convert back and forth between std::string and Qt::QString, etc. Are there any...
11
1899
by: BilfFord X | last post by:
If I # include "text.h" , where text.h consists of the following: # define NOTHING_IMPORTANT # include <stdio.h> , am I writing c++? cordially, bfx
21
2828
by: Kannan | last post by:
Its been a while I have done pure C programming (I was coding in C++). Is the following function valid according to standard C? int main(int argc, char *argv) { int x; x = 9; printf("Value of x is: %d\n", x);
56
3121
by: Chris Hills | last post by:
Hi, It came up in a standards panel meeting the other day that "all c or C++ programmers" have a copy of ISO C and/or C++ ... I challenged this and said most don't (outside those working on the standards). Well, do most of you have a copy of the relevant ISO language standard of your own or is there one on your desk at work?
3
3082
by: Eric Twietmeyer | last post by:
Hello, I have code written using the basic fstream object on a Win32 system. This is of course simply a typedef for basic_fstream<char, char_traits<char. This object can not be used to write or read files that are larger than 2Gb in size, as it would appear (from looking at the iosfwd header) that the underlying streamoff and streamsize types are typedef'd to long and int. On Win64 systems, these are typedef'd to __int64, so it seems...
31
1664
by: Francine.Neary | last post by:
One interesting thing to come out of the recent "Alignment" thread is that it is impossible to write a portable replacement for malloc in "user space" (not sure what the right term is - I mean an ordinary programmer, not an implementor) - even a naive method using a large array isn't guaranteed to work if there's no way of having a variable of strictest alignment. Oh, for the sake of the pedants, let's discount void *my_malloc(size_t...
14
12813
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in case it's a question, i want to popup a messageBox or something, and bring back to the batch file the result (Yes\No question). I know how to excute the batch file and get all the Standard output at the end, but i don't know who can i read it line by...
18
2453
by: Stephan Beal | last post by:
Hi, all! Before i ask my question, i want to clarify that my question is not about the code i will show, but about what the C Standard says should happen. A week or so ago it occurred to me that one can implement a very basic form of subclassing in C (the gurus certainly already know this, but it was news to me). What i've done (shown below) seems to work all fine and well, and does exactly what i'd expect, but i'm asking about
0
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7953
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.