473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

stl::fstream O_RDWR | O_CREAT

Hi,

Which ios_base flags does one use to open an fstream for

std::ios::out | std::ios::in | (create if necessary)

I do NOT necessarily want to truncate or append to the file.

I realize I can do it in two steps by checking the state of the file
stream after trying to open it, but I wanted to be sure I was not
missing a flag like O_RDWR | O_CREAT.

Thanks,

-Luther
Jul 22 '05 #1
2 3527

"Luther Baker" <lu*********@yahoo.com> wrote in message
news:46**************************@posting.google.c om...
Hi,

Which ios_base flags does one use to open an fstream for

std::ios::out | std::ios::in | (create if necessary)

I do NOT necessarily want to truncate or append to the file.

I realize I can do it in two steps by checking the state of the file
stream after trying to open it, but I wanted to be sure I was not
missing a flag like O_RDWR | O_CREAT.


This question was asked recently, see the thread 'fstream..' by dumboo. The
short answer is do it in two steps.

john
Jul 22 '05 #2
"John Harrison" <jo*************@hotmail.com> wrote in message news:<2h************@uni-berlin.de>...
"Luther Baker" <lu*********@yahoo.com> wrote in message
news:46**************************@posting.google.c om... ....
This question was asked recently, see the thread 'fstream..' by dumboo. The
short answer is do it in two steps.


Thanks John,

-Luther
Jul 22 '05 #3

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

Similar topics

30
by: Przemo Drochomirecki | last post by:
Hi, The task was indeed simple. Read 2.000.000 words (average length = 9), sort them and write it to new file. I've made this in STL, and it was almost 17 times slower than my previous...
12
by: Fraser Ross | last post by:
a std::ostream_iterator can be constructed from a ostream but not a fstream. If the fstream is opened with the out mode how can I get a ostream_iterator? I am not using a pointer to any base class....
3
by: coltrane | last post by:
Does the stl have any functionality for iterating through directories, i.e. findfirst findnext? thanks for your help john
7
by: John Ratliff | last post by:
Is this a legitimate (standards compliant) way to check for errors in file I/O. #include <fstream> fstream output("file.ext", std::ios_base::out, std::ios_base::binary); if (output) { //...
4
by: david.dfx | last post by:
-------------------------------------------------------------------------------- I'm having a problem implementing the STL map container using a class object. I'd like to use map to store a pair...
1
by: JoeZ | last post by:
Hi all, It seems that VC7 does not have fstream.h, I am wondering if any one had any experience to convert a VisualStudio6 project to .NET and fstream.h is included some where. TIA, JoeZ
8
by: Torsten Mueller | last post by:
I have a problem using the native STL implementation (this is a Rogue Wave one) with the aCC compiler (HP ANSI C++ B3810B A.03.55) on HPUX 11. Yes, it's old. But why it does not work? My program...
1
by: | last post by:
am studying a book called "STL for C++" by Leen Ammeraal. copy right 1997 I am on page 160 of 209 pages and I have to got the output right for all of the author's examples I had to change the...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.