42-archive/42sh/42ShellTester/support/display-pwd
2017-03-24 17:43:33 +01:00
..
description with 42shelltester error 2017-03-24 17:43:33 +01:00
main.c with 42shelltester error 2017-03-24 17:43:33 +01:00
Makefile with 42shelltester error 2017-03-24 17:43:33 +01:00
README.md with 42shelltester error 2017-03-24 17:43:33 +01:00

./display_pwd

A binary that writes on standard output the absolute path of the current directory returned by getcwd(3), encountered with the strings PWD: and :PWD.

#include <unistd.h>
#include <string.h>

int	main(void)
{
	char	*pwd;

	pwd = getcwd(NULL, 0);
	write(1, "PWD:", 4);
	write(1, pwd, strlen(pwd));
	write(1, ":PWD\n", 5);
	return (0);
}