style: added color to the ex01 of the module 01

This commit is contained in:
Raphael 2024-11-05 12:48:37 +01:00
parent 4054309f5e
commit 0271d4b2de
4 changed files with 42 additions and 8 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/04 15:48:46 by rparodi #+# #+# */
/* Updated: 2024/11/04 20:38:40 by rparodi ### ########.fr */
/* Updated: 2024/11/05 12:42:33 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,20 +16,20 @@ int main(int argc, char *argv[])
{
if (argc != 3)
{
std::cerr << "Error:\nYou have to use a numeric argument !\nRemember the syntax:\n\t" << argv[0] << " <name> <size>" << std::endl;
std::cerr << CLR_RED << "Error:\nYou have to use a numeric argument !\n" << CLR_RESET << CLR_BLUE << "Remember the syntax:\n\t" << argv[0] << " <name> <size>" << CLR_RESET << std::endl;
return 1;
}
std::string str(argv[2]);
if (str.length() > 10)
{
std::cerr << "Error:\nYou can only have an integer in parameters" << std::endl;
std::cerr << CLR_RED << "Error:\nYou can only have an integer in parameters" << CLR_RESET << std::endl;
return 2;
}
int size = std::atoll(argv[2]);
std::string name = std::string(argv[1]);
if (size <= 0)
{
std::cerr << "Error:\nThe number have to be positive" << std::endl;
std::cerr << CLR_RED << "Error:\nThe number have to be positive" << CLR_RESET << std::endl;
return 3;
}