Hi, I have a program which writes its output using ofstream. Everything works perfectly fine on Windows when compiled with Visual Studio, but it only writes empty file on Linux when compiled with GCC.
ofstream out(path_out_cstr, ofstream::out);
if(out.bad()){
cout << "Could not write the file" << flush;
}
else{
cout << "writing";
out << "Content" << endl;
if(out.fail()) cout << "writing failed";
out.flush();
out.close();
}
The directory which is being writen into has 0777 privileges.
The weird thing is: nothing is written, but no error is reported.
The gcc --version is: (Gentoo 4.3.4 p1.0, pie-10.1.5) 4.3.4
I'm aware the code SHOULD work, so I'm more like looking for suggestions, what could be wrong, than for direct code-fix.
EDIT: fwrite seems to fail in exactly the same fashion (nothing is writte, no error is reported).
EDIT: i'm exectuing both the GCC and the program over SSH on my university directory, if it can have any significance. I have sufficient permisssions to exectute and write files (ls . > out.txt works just fine), it only my program which has trouble.
Thanks for help