parsing changes to a directory name
whats the best way to parse changes to a directory name?
lets say i had a string like so
std::string directory="C:\\";
and i had a function that would take a working directory and a destination directory like so
changedirectory(directory,"windows");
and then directory would = C:\windows
however if for example i then did
changedirectory(directory,"..\\documents and settings");
then directory would = C:\documents and settings, this being able to support as many .. as needed so i can move relatively up any number of folders (if possible)
and finaly if i did
changedirectory(directory,"C:\\program files");
then directory would = C:\program files
basicly i need to write a function that changes directories much like dos did. with support for both absolute and relative (in all forms) path changing. i can kinda see how this is done, but i dont wanna reinvent the wheel if i dont have to. and if someone knows a fast, efficient, and working method id be very greatful to see how this is done.
Bungo!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement