|
Boost Users : |
From: Andrei Danaila (adanaila_ca_at_[hidden])
Date: 2006-09-29 13:06:21
Really sorry to be a pest, thanks alot for all the replies, I'm making
progress.
what i am trying now is:
path test("Test2")
string randomString="Random";
directory_iterator dir_itr(test);
rename(*dir_itr, randomString);
It compiles fine but i get a runtime error, I've used exception handling and
i get the following message: "Assertion failed: m_imp.get(), file
c:\boost2\libs\filesystem\build\../src/operations_posix_windows.cpp, line
317"
>From: "Michael Fawcett" <michael.fawcett_at_[hidden]>
>Reply-To: boost-users_at_[hidden]
>To: boost-users_at_[hidden]
>Subject: Re: [Boost-users] [FileSystem]Directory Iterator Question
>Date: Fri, 29 Sep 2006 12:13:54 -0400
>MIME-Version: 1.0
>Received: from wowbagger.osl.iu.edu ([129.79.245.252]) by
>bay0-mc12-f15.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Fri,
>29 Sep 2006 09:14:11 -0700
>Received: from wowbagger.osl.iu.edu (localhost [127.0.0.1])by
>wowbagger.osl.iu.edu (Postfix) with ESMTP id AF92C2C29D;Fri, 29 Sep 2006
>12:14:01 -0400 (EDT)
>Received: from wr-out-0506.google.com (wr-out-0506.google.com
>[64.233.184.238])by wowbagger.osl.iu.edu (Postfix) with ESMTP id
>B47F52C092for <boost-users_at_[hidden]>; Fri, 29 Sep 2006 12:13:55
>-0400 (EDT)
>Received: by wr-out-0506.google.com with SMTP id 57so323735wrifor
><boost-users_at_[hidden]>; Fri, 29 Sep 2006 09:13:55 -0700 (PDT)
>Received: by 10.90.52.2 with SMTP id z2mr1701527agz;Fri, 29 Sep 2006
>09:13:55 -0700 (PDT)
>Received: by 10.90.79.20 with HTTP; Fri, 29 Sep 2006 09:13:54 -0700 (PDT)
>X-Message-Info: txF49lGdW42U7tKBcVJBUOp915aBLRzX/R6GCQUqRgc=
>X-Original-To: boost-users_at_[hidden]
>Delivered-To: boost-users_at_[hidden]
>DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta;
>d=gmail.com;h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;b=E9CcnLr/OYsSmONqDaDUCnfLYVPF4p6Sms9nTHC2F60XK+CjM1twaWlUoUf2xqc8UJ6RFGfEMKK5dolZLyZ31VKs+phEEAvfVWI9KvajagKNfaUJky5K7IeWJXBHVvGzDW+24MgBVbLqsEvM58BPYCq2BEOeOvkKVhB6qZM+6kA=
>References:
><002601c6e3db$cdcee870$6707a8c0_at_pdimov2><BAY122-F9E5A05F33E0A7BCD451399D180_at_phx.gbl>
>X-BeenThere: boost-users_at_[hidden]
>X-Mailman-Version: 2.1.6
>Precedence: list
>List-Id: Boost Users mailing list <boost-users.lists.boost.org>
>List-Unsubscribe:
><http://lists.boost.org/mailman/listinfo.cgi/boost-users>,<mailto:boost-users-request_at_[hidden]?subject=unsubscribe>
>List-Archive: <http://lists.boost.org/MailArchives/boost-users>
>List-Post: <mailto:boost-users_at_[hidden]>
>List-Help: <mailto:boost-users-request_at_[hidden]?subject=help>
>List-Subscribe:
><http://lists.boost.org/mailman/listinfo.cgi/boost-users>,<mailto:boost-users-request_at_[hidden]?subject=subscribe>
>Errors-To: boost-users-bounces_at_[hidden]
>Return-Path: boost-users-bounces_at_[hidden]
>X-OriginalArrivalTime: 29 Sep 2006 16:14:11.0441 (UTC)
>FILETIME=[4CA19610:01C6E3E2]
>
>On 9/29/06, Andrei Danaila <adanaila_ca_at_[hidden]> wrote:
> >
> > Noob question, how do we rename a file obtained from a
>directory_iterator.
> > i'm attempting to compile the following much simplified example.
> >
> > directory_iterator i("whateverPath");
> > i++;
> > // i know i++ exists
> > rename (i->current_path(), TestRename);
> >
> > When i try to compile the above , it tells me that i is actually a
>"path"
> > object not a directory iterator.
>
>That is because you are dereferencing the iterator to the underlying
>path object. The compiler is correct. Try:
>
>rename (i.current_path(), TestRename); // dot not arrow!
>
> > However, when i try to write something like
> >
> > path test=i;
> >
> > it tells me i is actually a directory iterator not a path object.
>
>The compiler is again correct. Try:
>
>path test=*i; // dereference the iterator to get the path
>
>HTH,
>
>--Mike
>_______________________________________________
>Boost-users mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net