Dear gnu experts, I have a question on the GCC version.The followed code is ran succesfully under one version of GCC,but fail when I use gcc3.4.6.The code is: #include <fstream>
int set_output() { std::ofstream txt_stream; char txt_stream_file[400]; int status=0; strcpy(txt_stream_file,"plots/"); strcat(txt_stream_file,"results_"); strcat(txt_stream_file,galdef.galdef_ID); strcat(txt_stream_file,"_" ); strcat(txt_stream_file,workstring1); strcat(txt_stream_file,"_" ); strcat(txt_stream_file,workstring2); if(galplotdef.convolve_EGRET==0) strcat(txt_stream_file,"_unconv_" ); if(galplotdef.convolve_EGRET!=0) strcat(txt_stream_file,"_conv_" ); strcat(txt_stream_file,galplotdef.psfile_tag); strcat(txt_stream_file,".txt"); cout<<txt_stream_file<<endl; txt_stream.open(txt_stream_file,"w"); return status } The txt_stream_file is a file that I want to creat for postscript.When I compile it with another codes,out: set_output.cc:46: error: no matching function for call to `std::basic_ofstream<char, std::char_traits<char> >::open(char[400], const char[2])' /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/fstream:695: note: candidates are: void std::basic_ofstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>] I translated char txt_stream_file[400] to const char *file,but fail,could please you tell me how to solve it.Thank you very much. wl ang th7,August,2010 -- Summary: the difference of fstream's open() in different GCC version Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: china dot wenli dot wang at gmail dot com GCC host triplet: redhat linux enterprise4.8(gnu/gcc3.4.6) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45226