Closed alexey-malov closed 6 years ago
while (currentPosition + searchLength < lineLength)
{
const string subString = line.substr(currentPosition, searchLength); // <-- тут создаётся новая строка
if (subString == search)
{
newLine += replace;
currentPosition += searchLength;
}
else
{
newLine += line[currentPosition];
++currentPosition;
}
}
void CopyFileByReplacing(fstream& input, fstream& output, const string search,
const string replace)
{
fstream input(argv[1], istream::in);
fstream output(argv[2], ostream::out);
if (search != "")
if (!search.empty())
if (lineLength - currentPosition > 0)
{
newLine += line.substr(currentPosition, lineLength - currentPosition);
}
1>c:\teaching\ips\2018\oop\smirnov\cpp_oop_practice\lab_1\task_1\task_1.cpp(66): warning C4715: 'CopyFileByReplacing': not all control paths return a value