list initializer

This commit is contained in:
hugogogo
2022-02-07 14:47:39 +01:00
parent bb43bb40e8
commit 649b6168ef
5 changed files with 82 additions and 18 deletions

View File

@@ -1,24 +1,28 @@
#include "Sed.hpp"
#include <iostream>
#include <string>
#include <fstream>
int main() {
int sed_error(std::string msg) {
std::ifstream file("test.txt");
std::cout << msg << std::endl;
return 1;
}
// read words separated by whitespaces or newlines
// std::string str;
// while (file >> str)
// std::cout << str << std::endl;
void cpp_sed(char **av) {
// skip whitespaces or newlines
// char c;
// while (file >> c)
// std::cout << c << std::endl;
// seems good
char c;
while (file.get(c))
std::cout << c;
Sed sed(av[1], av[2], av[3]);
sed.replace();
}
int main(int ac, char **av) {
if (ac != 4)
return sed_error("you must provide 3 parameters : <file> <string 1> <string 2>");
cpp_sed(av);
return 0;
}