g++ 4.6.3 on Ubuntu 12.04 fails to open any fstream file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
If one declares a fstream class the file will never be opened.
A simple file to illustrate the bug is listed below.
#include <iostream>
#include <fstream> // std::ofstream
#include <iomanip>
#include <string>
using namespace std;
int main () {
fstream outfile;
outfile.open ("test.txt");
if (outfile.is_open()) {
string t;
outfile >> t;
cerr << t << endl;
long pos = outfile.tellp();
string s;
outfile >> s;
cerr << s << endl;
}else{
cerr << "error opening file tst.txt!\n";
}
outfile.
return 0;
}
g++ --version command yields:
patrick@
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Thank you!