update: pushing the start ex04 of the module 01

This commit is contained in:
raphael 2024-11-06 14:09:29 +01:00
parent 2b197d8d05
commit 08a23cc42b
6 changed files with 291 additions and 0 deletions

32
cpp01/ex04/main.cpp Normal file
View file

@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/05 15:24:29 by rparodi #+# #+# */
/* Updated: 2024/11/05 22:02:35 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "sed.hpp"
#include <fstream>
int main(int argc, char *argv[])
{
if (argc != 4)
{
std::cerr << CLR_RED ERR_PREFIX ARGS_MISSING << std::endl;
return (1);
}
std::ifstream input(argv[1]);
if (!input)
{
std::cout << CLR_RED ERR_PREFIX << argv[1] << FILE_CANT_OPEN << CLR_RESET << std::endl;
return (1);
}
Sed new_sed = Sed(argv, &input);
std::ofstream output = output(new_sed.getFilename());
while (new_sed.line(output)){}
}