update: finishing for good the last exercice
This commit is contained in:
parent
afd6bd90af
commit
4e8dc67e65
3 changed files with 13 additions and 7 deletions
|
|
@ -6,12 +6,14 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/05 15:24:29 by rparodi #+# #+# */
|
||||
/* Updated: 2024/11/06 16:09:06 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/11/06 16:36:48 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "err_msg.hpp"
|
||||
#include "sed.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -23,15 +25,15 @@ int main(int argc, char *argv[])
|
|||
std::ifstream input(argv[1]);
|
||||
if (!input)
|
||||
{
|
||||
std::cout << CLR_RED ERR_PREFIX << argv[1] << FILE_CANT_OPEN << CLR_RESET << std::endl;
|
||||
std::cerr << CLR_RED ERR_PREFIX << argv[1] << FILE_CANT_OPEN CLR_RESET << std::endl;
|
||||
return (1);
|
||||
}
|
||||
Sed new_sed = Sed(argv, &input);
|
||||
std::ofstream output(new_sed.getFilename());
|
||||
if (!output.is_open()) {
|
||||
std::cerr << "Error: Could not open the file for writing." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if (!output.is_open()) {
|
||||
std::cerr << CLR_RED ERR_PREFIX << new_sed.getFilename() << FILE_CANT_OPEN CLR_RESET << std::endl;
|
||||
return 1;
|
||||
}
|
||||
while (new_sed.line(output))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue