GETCWD(3)

πŸ“¦ version 93vu, in opensuse-leap 16.0

okay bestie, welcome to the GETCWD(3) page from the Library Functions Manual β€” it's giving β€œwhere am I?” but make it absolute path realness πŸ’…


πŸ’– NAME πŸ’–

getcwd β€” return absolute path to current directory πŸŽ€

✨ SYNOPSIS ✨

#include <ast.h>

char* getcwd(char* buf, size_t len);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so getcwd copies the absolute path name of the current directory info into buf of length len. no cap, that's the whole little mission 🫢

the return path may be longer than PATH_MAX β€” yes, bestie, it can really be that long 😭

if buff == 0 then space is allocated via malloc(3) and len extra characters are reserved after the generated path name. slay, built-in room for extra stuff ✨

a pointer to the path name is returned, 0 on error. periodt πŸ’€

🌈 SEE ALSO 🌈

  • pathcd(3) πŸ‘‘

xoxo, your GETCWD(3) bestie πŸ’– β€” that's the page from the Library Functions Manual, with a footer that's literally just GETCWD(3) and no extra date/version tea, periodt ✨

πŸ“¦ where this page comes from