Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

get current directory cpp

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

using std::cout; using std::cin;
using std::endl; using std::string;
using std::filesystem::current_path;

int main() {
    char tmp[256];
    getcwd(tmp, 256);
    cout << "Current working directory: " << tmp << endl;

    return EXIT_SUCCESS;
}
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #current #directory #cpp
ADD COMMENT
Topic
Name
6+8 =