#include <iostream>

 #include <fstream>

 #include <sstream>

 #include <string>

...

203   int main(int argc, char *argv[])

204   {

...

283   std::ofstream fout("testOutput.txt");

284   fout.flush();

...
294   fout << "1)\n";
...
400   if (fout.is_open())
401   fout.close();
402   return 0;
403   }

대충 이런 코드인데, std::cout으로는 결과가 잘 나오는데 ofstream으로 출력하려 하니 빈 파일만 생성되고 끝납니다.
어떻게 하면 해결할 수 있을까요?
Ubuntu 12.04.5 LTS입니다