Topic: fstream nocreate compile error
Author: imadufus@my-dejanews.com
Date: 1998/09/08 Raw View
I'm getting an error trying to compile the following code using VC++ 5.0.
#include <fstream>
void main()
{
std::ofstream out_stream;
// openmode enum is not reachable here.
out_stream.open("test.txt", std::ios::noreplace);
...
out_stream.close();
}
The error is:
error C2039: 'noreplace' : is not a member of
'basic_ios<char,struct std::char_traits<char>>'
I can't explain this error since 'noreplace' is part of the openmode enum
in the ios class not basic_ios. What do I have to do to get this to compile?
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: veldy@visi.com (Thomas T. Veldhouse)
Date: 1998/09/08 Raw View
On 08 Sep 98 16:17:28 GMT, imadufus@my-dejanews.com wrote:
>I'm getting an error trying to compile the following code using VC++ 5.0.
>
> #include <fstream>
>
> void main()
> {
> std::ofstream out_stream;
>
> // openmode enum is not reachable here.
> out_stream.open("test.txt", std::ios::noreplace);
>
> ...
>
> out_stream.close();
> }
>
>The error is:
>
> error C2039: 'noreplace' : is not a member of
> 'basic_ios<char,struct std::char_traits<char>>'
>
It looks as if these are your only options:
std::ios::app
std::ios::ate
std::ios::binary
std::ios::in
std::ios::out
std::ios::trunc
[ moderator's note: Excessive quoting deleted. Please do not quote
more material than is needed to understand the reply. -sdc ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]