Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Reversing a folder path in a string

Reply
Thread Tools

Reversing a folder path in a string

 
 
Lindsay
Guest
Posts: n/a
 
      07-17-2005
How is this done?

For example:

How do I programmatically change "C:\Windows\System32" into
"System32\Windows\C:"?

Some pointers please?


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      07-17-2005
Lindsay wrote:
> How is this done?
>
> For example:
>
> How do I programmatically change "C:\Windows\System32" into
> "System32\Windows\C:"?
>
> Some pointers please?



Split it into strings, put the strings in a list, then print
the list backwards. I am not sure what "pointers" you need.
std::string has 'find', 'substr'. std::list has 'push_back'
and 'rbegin' and 'rend'. Beyond that I would be writing it
for you, and I don't want to.

V


 
Reply With Quote
 
 
 
 
leonardo77
Guest
Posts: n/a
 
      07-17-2005
Lindsay wrote:
> How is this done?


> For example:



> How do I programmatically change "C:\Windows\System32" into
> "System32\Windows\C:"?



> Some pointers please?


Tokenize with your favorite tokenizer library(possibly boost's),put the
stuff into your favorite conatiner library(probably STL),then reverse
the container.

 
Reply With Quote
 
upashu2
Guest
Posts: n/a
 
      07-18-2005
Instead of using container/ list, a separate string can also be used,
read the first string "C:\windows\system" and find "\" from reverse
side, then extract substrings, put into another output string as
system\windows\........

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reversing a string without using array, classes and reverse function Rubist Rohit Ruby 19 04-23-2011 09:16 PM
Reversing a string Scott Python 23 07-05-2007 08:20 PM
Reversing order of words in a given string Kelly B C Programming 2 04-26-2007 02:52 PM
String reversing problem Albert C Programming 46 01-04-2006 10:49 AM
reversing a string - newbie question netforce C Programming 9 03-08-2004 12:04 AM



Advertisments