i just want to know:
fstream obj("file", ios:ut | ios::in)
is better for working with binary files, tham ofstream and ifstream?
i ask this because i noticed that if i write to a file in binary mode
with ofstrem all the previous data stored in the binary data is deleted
, if i use ios::app all the data is stored at the end of file, and i cant write data in any place of the file that i want.
if i try to make an aplication like a database, the ofstrem dont work well.
so with fstream i can write to any place in the file with no problem.
one more question:
why fstream obj("file",ios:ut | ios::in) dont create the file if the file dont exists? how to deal with this? or i need to work with ofstream to create the file and then work with fstream to deal with the file i/o?
im rigth? any ideas?
thanks for any help, and please excuse my poor english.