update: pushing the start ex04 of the module 01
This commit is contained in:
parent
2b197d8d05
commit
08a23cc42b
6 changed files with 291 additions and 0 deletions
32
cpp01/ex04/main.cpp
Normal file
32
cpp01/ex04/main.cpp
Normal 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)){}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue