list initializer
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user