A lot of edit but adding the struct (Yes, i just use parameters of the function util now, See u morrow)

This commit is contained in:
Raphaël 2024-04-01 01:55:59 +02:00
parent 9c4dfafdf7
commit 56655f5426
15 changed files with 403 additions and 30 deletions

26
test/main.c Normal file
View file

@ -0,0 +1,26 @@
#include "../includes/minishell.h"
int main()
{
char *cwd;
size_t size;
cwd = (char *)malloc(size);
size = 1024;
if (cwd == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}
while (getcwd(cwd, size) == NULL) {
size *= 2;
cwd = (char *)realloc(cwd, size);
if (cwd == NULL) {
perror("realloc");
exit(EXIT_FAILURE);
}
}
printf("Le répertoire de travail actuel est : %s\n", cwd);
free(cwd); // N'oubliez pas de libérer la mémoire allouée
return 0;
}