Hi, Im trying to write to specific points in a file, but the write() erases everything in the document..heres what im doing:
the file:

mode 0 ;
level 0 ;
menu 1 ;

the code:

ofstream data_w_fil;
	data_w_fil.open("data.gsp");

	data_w_fil.seekp(7);
	data_w_fil.write(mode, 1);
	data_w_fil.seekp(18);
	data_w_fil.write(level,1);
	data_w_fil.seekp(28);
	data_w_fil.write(menu, 1);

Whats going on?

Heres the result :
the file:

0          0         1
data_w_arq.open("data.gsp",ios::in);

¦D solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.