This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: ofstream crash with libstdc++
- From: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- To: Mahmood Naderan <nt_mahmood at yahoo dot com>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Tue, 19 Feb 2013 16:30:15 +0530
- Subject: Re: ofstream crash with libstdc++
- References: <1361271141.31313.YahooMailNeo@web163004.mail.bf1.yahoo.com>
On 19 February 2013 16:22, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
> I have wrote a code that contains
>
>
> .....
> std::string f;
> std::fstream
> fout;
> f = "filter";
> fout.open(f.c_str(), std::fstream::app | std::fstream::out);
> fout << "--------------------messages format--------------------------\n"; // LINE 207
> ....
>
> At the last line, gdb reports a crash with this information
>
It's easier if you give code that actually demonstrates the crash than
a snippet of code within some larger code. At this point it's easier
to assume that your code is at fault somehow. For one, the open
operation could easily have failed. It might be useful to enable
exceptions[1] on the stream and see if the open actually failed.
[1] http://www.cplusplus.com/reference/ios/ios/exceptions/
--
http://siddhesh.in