A simple question of fstream
Ajay Bansal
Ajay_Bansal@infosys.com
Thu Jan 30 10:15:00 GMT 2003
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..
:( :(
More information about the Gcc-help
mailing list