Python has some nice features for working with paths: http://docs.python.org/lib/module-os.path.html

Does anybody know of any C/C++ functions, techniques or libraries to do something similar?

For example, if I'm passed a path on the commandline as such:

x = "~/mystuff/../myfile.txt"

In python I could get the absolute path as such:

os.path.abspath( os.path.expanduser( x ) )

would return the following for a user called fred:

/home/fred/myfile.txt

Any suggestions for an easy way to accomplish something similar in C/C++?
Thanks