C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

kein ios::noreplace in MSVC60 ?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Christian Buhtz
Guest





PostPosted: Sun Feb 12, 2006 8:06 pm    Post subject: kein ios::noreplace in MSVC60 ? Reply with quote



Ich versuche folgendes:

ofstream fHeader(strHeader.c_str(), ios::noreplace | ios::out );

Mein compiler sagt dazu:
E:\Garage\projekte\shitcode\shitcode.cpp(95) : error C2039: 'noreplace'
: Ist kein Element von 'basic_ios<char,struct std::char_traits<char> >'

In shitcode.cpp habe ich folgende includes:
#include "stdafx.h"
#include "shitcode.h"
#include <string>
#include <iostream>
#include <time.h>
#include <sys/stat.h>

und ein using namespace.

Ich nutze hier MSVC60. In der MSDN wird ios::noreplace beschrieben!

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
kanze
Guest





PostPosted: Mon Feb 13, 2006 12:06 pm    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote



Christian Buhtz wrote:
Quote:
Ich versuche folgendes:

ofstream fHeader(strHeader.c_str(), ios::noreplace | ios::out );

ios::noreplace ist mir neu. Habe nie davon gehört.

Quote:
Mein compiler sagt dazu:
E:\Garage\projekte\shitcode\shitcode.cpp(95) : error C2039: 'noreplace'
: Ist kein Element von 'basic_ios<char,struct std::char_traits<char> >'

In shitcode.cpp habe ich folgende includes:
#include "stdafx.h"
#include "shitcode.h"
#include <string
#include <iostream
#include <time.h
#include <sys/stat.h

Und kein #include <fstream>?

Quote:
und ein using namespace.

Ich nutze hier MSVC60. In der MSDN wird ios::noreplace
beschrieben!

Ich weiß nicht, was in MSDN beschrieben wird, aber
ios::noreplace wird nicht in der C++-Norm beschrieben. Wenn es
gibt, dann wäre es eine Erweiterung deines Compilers.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Peter Stöcklein
Guest





PostPosted: Mon Feb 13, 2006 7:06 pm    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote



"Christian Buhtz" <yspam (AT) gmx (DOT) net> schrieb im Newsbeitrag
news:459f4nF5f5okU1 (AT) individual (DOT) net...
Quote:
Ich versuche folgendes:

ofstream fHeader(strHeader.c_str(), ios::noreplace | ios::out );


ios::noreplace ist Bestandteil der alten nicht C++ standardkonformen Stream
bzw. Standardbibliothek Implementation.

Zum Vorgehen siehe
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Differences_in_iostream_implementation.asp

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Christian Buhtz
Guest





PostPosted: Mon Feb 13, 2006 7:06 pm    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote

On 13 Feb 2006 03:53:20 -0800, kanze wrote:
Quote:
ofstream fHeader(strHeader.c_str(), ios::noreplace | ios::out );

ios::noreplace ist mir neu. Habe nie davon gehört.

Wie verhindere ich dann, das ein ofstream::open() die Datei
überschreibt, falls sie schon vorhanden ist? Er soll sie auch nicht
erweitern. open() soll nur funktionieren, wenn die Datei noch nicht
existiert.

Quote:
Ich weiß nicht, was in MSDN beschrieben wird, aber
ios::noreplace wird nicht in der C++-Norm beschrieben. Wenn es
gibt, dann wäre es eine Erweiterung deines Compilers.

Darüber läßt sich die MSDN leider nie so genau aus, was ISO und was
properitär ist.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Thomas Maeder
Guest





PostPosted: Mon Feb 13, 2006 8:06 pm    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote

Christian Buhtz <yspam (AT) gmx (DOT) net> writes:

Quote:
Wie verhindere ich dann, das ein ofstream::open() die Datei
überschreibt, falls sie schon vorhanden ist? Er soll sie auch nicht
erweitern. open() soll nur funktionieren, wenn die Datei noch nicht
existiert.

Ich glaube nicht, dass das mit der Standardbibliothek möglich ist.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Dietmar Kuehl
Guest





PostPosted: Tue Feb 14, 2006 1:06 am    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote

Thomas Maeder wrote:
Quote:
Ich glaube nicht, dass das mit der Standardbibliothek möglich ist.

std::ofstream out;
if (!std::ifstream("foo"))
out.open("foo");

Transaktionalität gibt es auf Stream-Level ohnehin nicht, so dass
man das auch in zwei Operationen aufteilen kann.
--
<mailto:dietmar_kuehl (AT) yahoo (DOT) com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
kanze
Guest





PostPosted: Tue Feb 14, 2006 1:06 pm    Post subject: Re: kein ios::noreplace in MSVC60 ? Reply with quote

Dietmar Kuehl wrote:
Quote:
Thomas Maeder wrote:
Ich glaube nicht, dass das mit der Standardbibliothek möglich ist.

std::ofstream out;
if (!std::ifstream("foo"))
out.open("foo");

Transaktionalität gibt es auf Stream-Level ohnehin nicht, so
dass man das auch in zwei Operationen aufteilen kann.

Geht auch nicht, wenn ich keine Leserechte auf der Datei habe.
Im unwahrscheinlichen Fall, dass ich nur Schreiberechte, nicht
aber Leserechte habe, dann kann ich sogar die Datei
überschreiben.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.