I am making a simple encryption program, but I can't get the return function right. I want to replace the [ with \n. But I can't get this to work. This is my current solution: 
#include <string>
#include <iostream>
#include <algorithm>
#include <fstream>
std::ifstream in("file.txt");
std::ofstream out("result.txt");
std::string line;
while (!in.eof())
{
    std::getline(in, line);
    std::replace(line.begin(), line.end(), "[", "\n");
    out << line;
}
