d01 ex04 erreur saute des find possibles
This commit is contained in:
@@ -22,12 +22,17 @@ void Sed::replace() {
|
||||
{
|
||||
if (str[0] == this->_find[0])
|
||||
{
|
||||
tmp = str[0];
|
||||
file.get(str, len, EOF);
|
||||
if (this->_find.compare(1, len - 1, str) == 0)
|
||||
if (len == 1)
|
||||
new_file << this->_replacement;
|
||||
else
|
||||
new_file << tmp << str;
|
||||
{
|
||||
tmp = str[0];
|
||||
file.get(str, len, EOF);
|
||||
if (this->_find.compare(1, len - 1, str) == 0)
|
||||
new_file << this->_replacement;
|
||||
else
|
||||
new_file << tmp << str;
|
||||
}
|
||||
}
|
||||
else
|
||||
new_file << str;
|
||||
|
||||
Reference in New Issue
Block a user