How can I delete the old entries from the .txt file and replace them with the new ones?

Like : I have a text file that has "123" in it, when I try to change the txt file it just adds the new text, I add "abc" to it and it comes out "123abc", but I want it to just be "abc" in it.

#include <iostream>
#include <fstream>      
using namespace std;
#include <stdio.h>

int main () {
    string text;

    fstream fails;"Teksts.txt",ios::out | ios::app);

      cout << "Enter word you want to replace the old entry with: ";
        cin >> text;

        fails << text;

  return 0;

So I changed the "ios::out | ios::app" to just ""Teksts.txt", ios::out);

Doing this it dose get rid of the old entry, and replaces it with the new one, or just creates a new file with the new entry?

Why isthis good/bad to use? Except ofcurse thet I can only "delete" all, insted of one entry.

This question has already been answered. Start a new discussion instead.