What\'s the best way to expand
${MyPath}/filename.txt to /home/user/filename.txt
or
%MyPath%/filename.txt to c:\\Document
For UNIX (or at least POSIX) systems, have a look at wordexp:
#include
#include
using namespace std;
int main() {
wordexp_t p;
char** w;
wordexp( "$HOME/bin", &p, 0 );
w = p.we_wordv;
for (size_t i=0; i
It seems it will even do glob-like expansions (which may or may not be useful for your particular situation).