Sanja Melnichuk
Sanja Melnichuk

Reputation: 3505

fstream save file and file system cross-linked files

Is there a good way to ensure file content is the same you write if your file system have a lot of cross-linked files.

Problem is when i write file content close file and reopen it file corrupted with some other lines from other files. So if i write "AAA" in the file, next time i open file i got: "AAABBBsome stuff". Code:

fstream stream;
stream.open(file_name.c_str(),ios::out | ios::trunc);
if (stream.is_open())
{
  stream.write(content,(streamsize)size);
  stream.close();
}

If any one have some ideas please write it. Thanks a lot

Upvotes: 1

Views: 264

Answers (1)

Hasturkun
Hasturkun

Reputation: 36412

There's nothing you can do programmaticly that would help, either create a new file, or ensure that you don't have any cross-linked files (recommended, really, fix your file system)

Upvotes: 4

Related Questions