Programming-Idioms

Implementation
C

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another C implementation.

Other implementations
import "os"
dir, err := os.Getwd()
import std.path;
string dir = absolutePath;
dir := expandfilename('.');
import System.Directory
dir <- getCurrentDirectory
with Ada.Directories; use Ada.Directories;
Dir : String := Current_Directory;
use Cwd;
my $dir = getcwd();
String path = this.getClass().getClassLoader().getResource("").getPath();
$dir = getcwd();
dir = Dir.pwd
import os
dir = os.getcwd()
use std::env;
let dir = env::current_dir().unwrap();
let dir = process.cwd ()
using System.IO;
string path = Directory.GetCurrentDirectory();
dir = os.getenv("PWD") or io.popen("cd"):read()
#include <filesystem>
dir = std::filesystem::current_path();