0

#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
class lohi
{
int x;
int y;
public :

lohi()
{
x=10;
y=20;
}

}X;
int main()
{
fstream io;
io.open("just1",ios::in | ios:: out | ios::app);
io.write((char*)&X,sizeof(X));
io.close();
}

in this programme i expect a file to be created and contents of x,y to be in it........
but................................................................................................................
its not at all creating a file ..
brothers please help

3
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by ivailosp
0
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
class lohi {
	int x;
	int y;
public:
	lohi() {
		x=10;
		y=20;
	}

} X;
int main() {
	fstream io;
	io.open("just1", ios::out | ios::app);
	io.write((char*)&X, sizeof(X));
	io.close();
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.