"use shell symbols in directory path" Code Answer


You can use wordexp:

#include <wordexp.h>

std::string wordexp(std::string var, int flags = 0)
    wordexp_t p;
    if(!wordexp(var.c_str(), &p, flags))
        if(p.we_wordc && p.we_wordv[0])
            var = p.we_wordv[0];
    return var;

int main()
    std::cout << wordexp("~/test") << 'n';
By Arne Deutsch on May 16 2022

Answers related to “use shell symbols in directory path”

Only authorized users can answer the Search term. Please sign in first, or register a free account.