This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ofstream crash with libstdc++


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]