Subject: Re: GCC3 problems with C++ fstream
From: Ney André de Mello Zunino <[email-masked]>
To: [email-masked]
Date: Tue, 13 Aug 2002 02:12:24 +0900

Gerrit P. Haase wrote:

> #include <fstream>
> void main() //the program starts here

main() must return 'int'

> {
> ofstream SaveFile("cygwin.txt");

ofstream lives in the 'std' namespace

> SaveFile << "Hello World, this works with gcc-2 but not with gcc-3!";
> SaveFile.close();
> }

Try this corrected version:

#include <fstream>

int main()
{
  using namespace std;

  ofstream saveFile("test.txt");
  saveFile << "Hello World, this works with gcc-2 but not with gcc-3!";
  saveFile.close();

  return 0;
}

Hope this helps,

-- 
Ney André de Mello Zunino
Media and Technology Laboratory
Campus Computing Centre
United Nations University

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/