Started from buttom go to the sky
This commit is contained in:
parent
96215449bd
commit
f811e55dea
4781 changed files with 10121 additions and 1743 deletions
26
test/main.c
26
test/main.c
|
|
@ -1,26 +0,0 @@
|
|||
#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;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue