deleting a boost::filesystem::path object

Discussion in 'C++' started by Daz, May 13, 2006.

  1. Daz

    Daz Guest

    Hi Everyone.

    I am sturggling trying to find out a way in which I can delete a 'path'
    object. I may not need to delete it, however, I need to overwrite it.
    The function I am trying to code, converts a string into a 'path'
    object, then checks to see if it exists. If it doesn't exist, the path
    object needs to be reused and the new path string put into it (not
    appended to it).

    If anyone could help, or point out where I can find this information,
    it would be very much appreciated. I have tried looking on boost.org,
    but get lost in all the jargon and can't seem to find what I am looking
    for.

    Thanks in advance.

    Daz
    Daz, May 13, 2006
    #1
    1. Advertising

  2. Daz

    Phlip Guest

    Daz wrote:

    > If anyone could help, or point out where I can find this information,
    > it would be very much appreciated. I have tried looking on boost.org,
    > but get lost in all the jargon and can't seem to find what I am looking
    > for.


    You might get much better results on the boost-users mailing list. It's
    worth subbing to, at least until you get over the learning curve, and you
    can lurk at news:news.gmane.org .

    --
    Phlip
    http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
    Phlip, May 13, 2006
    #2
    1. Advertising

  3. Daz

    Daz Guest

    Phlip wrote:

    > Daz wrote:
    >
    > > If anyone could help, or point out where I can find this information,
    > > it would be very much appreciated. I have tried looking on boost.org,
    > > but get lost in all the jargon and can't seem to find what I am looking
    > > for.

    >
    > You might get much better results on the boost-users mailing list. It's
    > worth subbing to, at least until you get over the learning curve, and you
    > can lurk at news:news.gmane.org .
    >
    > --
    > Phlip
    > http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!


    I will do just that. Thanks for the advice :)
    Daz, May 13, 2006
    #3
  4. Daz

    Daz Guest

    Daz wrote:

    > I will do just that. Thanks for the advice :)


    Ok, I think I really am more stupid than I had originally suspected. I
    am quite new to news groups, and I seriously don't understand how to
    subscribe to the group, if I need software to view it, and how to
    compile it on windows if it is needed. The only thing I can see for me
    to do, is fill in a form, which looks as though it will create a new
    group, which I don't think I want to do, or do I?

    It doesn't look like anything I have ever seen before, and I have read
    the FAQs which are very helpful, if I were to start a new group... :(

    Sorry for being stupid, but thanks for your help. I will see if I can
    figure it out.

    Daz
    Daz, May 13, 2006
    #4
  5. Daz wrote:
    > Hi Everyone.
    >
    > I am sturggling trying to find out a way in which I can delete a 'path'
    > object. I may not need to delete it, however, I need to overwrite it.
    > The function I am trying to code, converts a string into a 'path'
    > object, then checks to see if it exists. If it doesn't exist, the path
    > object needs to be reused and the new path string put into it (not
    > appended to it).


    path_object = boost::filesystem::path(new_path_string);
    Markus Schoder, May 13, 2006
    #5
  6. Daz

    Phlip Guest

    Daz wrote:

    > Ok, I think I really am more stupid than I had originally suspected. I
    > am quite new to news groups


    It's a mailing list. It's great for the full-timers, and sucks for
    part-timers (quite the reverse of USENET). Fill out the form on their web
    site, put your addy in, and you are there.

    (And our newsgroup here is probably useful for _light_ Boost stuff...)

    --
    Phlip
    http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
    Phlip, May 13, 2006
    #6
  7. Daz

    Daz Guest

    Phlip wrote:

    > Daz wrote:
    >
    > > Ok, I think I really am more stupid than I had originally suspected. I
    > > am quite new to news groups

    >
    > It's a mailing list. It's great for the full-timers, and sucks for
    > part-timers (quite the reverse of USENET). Fill out the form on their web
    > site, put your addy in, and you are there.
    >
    > (And our newsgroup here is probably useful for _light_ Boost stuff...)
    >
    > --
    > Phlip
    > http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!


    Excellent! I was just worried that I might have been needlessly
    creating a new group that I had no intention of maintaining.

    Thanks again Phlip. Both for your time, and your patience :)

    It's very much appreciated.

    Daz
    Daz, May 13, 2006
    #7
  8. Daz

    Daz Guest

    Markus Schoder wrote:

    > Daz wrote:
    > > Hi Everyone.
    > >
    > > I am sturggling trying to find out a way in which I can delete a 'path'
    > > object. I may not need to delete it, however, I need to overwrite it.
    > > The function I am trying to code, converts a string into a 'path'
    > > object, then checks to see if it exists. If it doesn't exist, the path
    > > object needs to be reused and the new path string put into it (not
    > > appended to it).

    >
    > path_object = boost::filesystem::path(new_path_string);


    Aaah, yes! I seem to remember reading about this in a tutorial
    somewhere on c++ classes. I don't know why I didn't think of it, I
    tried virtually everything else!

    Thanks for the help Markus, much appreciated!
    Daz, May 13, 2006
    #8
  9. Daz wrote:
    > Markus Schoder wrote:
    >
    > > Daz wrote:
    > > > Hi Everyone.
    > > >
    > > > I am sturggling trying to find out a way in which I can delete a 'path'
    > > > object. I may not need to delete it, however, I need to overwrite it.
    > > > The function I am trying to code, converts a string into a 'path'
    > > > object, then checks to see if it exists. If it doesn't exist, the path
    > > > object needs to be reused and the new path string put into it (not
    > > > appended to it).

    > >
    > > path_object = boost::filesystem::path(new_path_string);

    >
    > Aaah, yes! I seem to remember reading about this in a tutorial
    > somewhere on c++ classes. I don't know why I didn't think of it, I
    > tried virtually everything else!


    (namespace fs = boost::filesystem;)

    Note however that fs::path() does not understand native path formats by
    default, you must give it fs::native:

    fs::path p("c:\\file", fs::native);

    If you don't, it'll throw.


    Jonathan
    Jonathan Mcdougall, May 13, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. perseus
    Replies:
    18
    Views:
    624
    Noah Roberts
    Aug 18, 2003
  2. perseus
    Replies:
    65
    Views:
    1,888
    Greg Schmidt
    Aug 19, 2003
  3. perseus
    Replies:
    7
    Views:
    449
    perseus
    Aug 12, 2003
  4. Matthias

    boost::filesystem: Aborted

    Matthias, Jan 29, 2005, in forum: C++
    Replies:
    2
    Views:
    1,224
    Andreas Huber
    Jan 29, 2005
  5. Lise
    Replies:
    0
    Views:
    103
Loading...

Share This Page