I am trying to run below code but it is neither showing any file on the path nor reading anything from it. Whatever I am writing into the file through "cin >>" it is not being written. Can anybody please let me know mistake in my code below:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
    char string[80];
    cout << "Enter Input" << endl;
    cin >> string;
    int len = strlen(string);
    fstream file;
    file.open("TEXT", ios::in | ios::out);
    for (int i = 0; i < len; i++)
        file.put(string[i]);
    file.close();
    file.open("TEXT", ios::in | ios::out);
    file.seekg(0);
    cout << "Output" << endl;
    while (file) {
        char ch;
        file.get(ch);
        cout << ch;
    }
    file.close();
    return 0;
}
 
     
    