This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.. 
:( :( 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]