Tcl_GetCwd(3)
Tcl_GetCwd π β manipulate the current working directory
okay bestie, so we're in Tcl_GetCwd(3) territory, and this is literally the Tcl Library Procedures page for Tcl_GetCwd and Tcl_Chdir. two lil functions, one big vibe: getting and setting where your app thinks it lives. π β¨
πΈ SYNOPSIS πΈ
#include <tcl.h>
char *
Tcl_GetCwd(interp, bufferPtr)
int
Tcl_Chdir(dirName)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter where we drop an error message if anything goes sideways. it's giving "tell the interp, not me" energy. πTcl_DString *bufferPtr(in/out) β this dynamic string is where the current working directory gets stored. at the time of the call it should be uninitialized or free. and bestie, the caller must eventually callTcl_DStringFreeto free up anything stored here. no leaks, we don't do that. πconst char *dirName(in) β the file path, in UTF-8 format. π¦
β¨ DESCRIPTION β¨
these procedures may be used to manipulate the current working directory for the application. they give you C-level access to the exact same functionality as the Tcl pwd command. iykyk. π₯
Tcl_GetCwd returns a pointer to a string specifying the current directory, or NULL if the current directory could not be determined. if NULL comes back, an error message is left in the interp's result. storage for the result string is allocated in bufferPtr; the caller must call Tcl_DStringFree() when the result is no longer needed. the format of the path is UTF-8. β
Tcl_Chdir changes the application's current working directory to the value specified in dirName. the format of the passed in string must be UTF-8. the function returns -1 on error or 0 on success. main character behavior honestly. π
π«Ά KEYWORDS π«Ά
pwd
and that's the whole page, bestie!! π this was the Tcl 8.1 era, dated right there in the footer, from the Tcl Library Procedures manual set β so if you ever need to know where you are or tell your app where to be, you know exactly who to call. slay, periodt, go free your Tcl_DStrings. πβ¨
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 1998-1999 Scriptics Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms