pourquoi il demande un buffer en parametre lui ?

This commit is contained in:
2024-02-16 21:20:10 +01:00
parent aeac20ccb0
commit 8d77586948

9
pwd.c
View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/09 18:31:21 by tomoron #+# #+# */ /* Created: 2024/02/09 18:31:21 by tomoron #+# #+# */
/* Updated: 2024/02/13 16:18:01 by marde-vr ### ########.fr */ /* Updated: 2024/02/16 21:19:30 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "minishell.h" #include "minishell.h"
@ -15,10 +15,9 @@ int pwd(void)
{ {
char *buffer; char *buffer;
buffer = malloc(1024 * 1024); buffer = getcwd(NULL, 0);
if (!buffer) if(!buffer)
return (1); return(1);
getcwd(buffer, 1024 * 1024);
ft_printf("%s\n", buffer); ft_printf("%s\n", buffer);
free(buffer); free(buffer);
return (0); return (0);