This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
A simple question of fstream
- From: "Ajay Bansal" <Ajay_Bansal at infosys dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 30 Jan 2003 14:01:12 +0530
- Subject: A simple question of fstream
Hi All
I want from the following program to create a new file & write into it.
But it is not doing so. I am compiling with gcc 3.2.1
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <errno.h>
using namespace std;
int main()
{
fstream iostrm;
iostrm.open("new1.txt",ios::out | ios::in);
cout<<errno;
iostrm.write("gagan",5);
iostrm.close();
return 1;
}
What is wrong over here. If I compile the program using gcc 2.95, I get
a new file.
-Ajay
PS: about my prior mails on compatibility issues with 2.95 & 3.2.1... I
am changing my code to meet with the standards..
:( :(