473,399 Members | 2,146 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,399 software developers and data experts.

Is std::ios::noreplace non-standard?

Hi,

when compiling the following code with gcc or g++, I get the error
message "test.cpp:6: `noreplace' is not a member of type
`std::basic_ios<char, std::char_traits<char> >'"

Shouldn't this work? Is there another way to check if a file already
exists before creating it?

#include <iostream>
#include <fstream>
int main()
{
std::ofstream log_file;
log_file.open( "filename", std::ios::noreplace );
return 0;
}
/ martin

Jul 19 '05 #1
1 4358
> when compiling the following code with gcc or g++, I get the error
message "test.cpp:6: `noreplace' is not a member of type
`std::basic_ios<char, std::char_traits<char> >'"


std::ios::noreplace is not standard.

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl
Jul 19 '05 #2

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

Similar topics

3
by: Mahmood Ahmad | last post by:
Hello, I have written a program that reads three types of records, validates them acording to certain requirements and writes the valid records into a binary file. The invalid records are...
5
by: TheDD | last post by:
Hello all, i've downloaded the source code of a GPL project but i don't manage to compile it. It have been written with an old g++ (<3) since there are #include <xxx.h> and no std:: at all......
7
by: Fraser Ross | last post by:
#include <fstream> #pragma hdrstop #include <condefs.h> #pragma argsused int main(int argc, char* argv) { std::fstream I; I.open("C:\\File.ext"); if (I.is_open()) { unsigned short a;
5
by: Dennis | last post by:
if you have the headers and main in below code snippet, the below ios::noreplace creates an error: error C2039: 'noreplace' : is not a member of 'basic_ios<char,struct std::char_traits<char> >'...
103
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it...
10
by: sherifffruitfly | last post by:
Hi all, This isn't minimal code, but at least it gives the idea reasonably well - and yes, I'm a newb :( The point of me giving this code is that all three vars look to my eye as though...
13
by: Gianni Mariani | last post by:
What I would like to do is read bytes from a stream, any number and any time. I would like it to wait until there are any bytes to read. I want the exact same functionality as cstdio's "fread"...
6
by: Rudolfs.Bundulis | last post by:
As I understood it's better to use fstream instead of fstream.h. When I was porting my code (i'm using VC6.0++) i needed to let go of such things as ios::noreplace and ios::nocreate. I neede to...
6
by: Ralf Goertz | last post by:
Hi, I'd like to use copy() to send the content of an integer container to cout. How can I make sure that /all/ of them are printed with width 2? #include <iostream> #include <iterator> int...
6
by: Ramesh | last post by:
Hello, I am using the ofstream class to create a text file with keys and values like: Key1=Value10 Key2=Value15 Key3=Value20 In case I need to set a new value for Key2, say value50 - I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.