
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"
Reply-To: boost-users@lists.boost.org To: boost-users@lists.boost.org 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 ; Fri, 29 Sep 2006 12:13:55 -0400 (EDT) Received: by wr-out-0506.google.com with SMTP id 57so323735wrifor ; 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@lists.boost.org Delivered-To: boost-users@lists.boost.org 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@pdimov2> X-BeenThere: boost-users@lists.boost.org X-Mailman-Version: 2.1.6 Precedence: list List-Id: Boost Users mailing list List-Unsubscribe: http://lists.boost.org/mailman/listinfo.cgi/boost-users,mailto:boost-users-request@lists.boost.org?subject=unsubscribe List-Archive: http://lists.boost.org/MailArchives/boost-users List-Post: mailto:boost-users@lists.boost.org List-Help: mailto:boost-users-request@lists.boost.org?subject=help List-Subscribe: http://lists.boost.org/mailman/listinfo.cgi/boost-users,mailto:boost-users-request@lists.boost.org?subject=subscribe Errors-To: boost-users-bounces@lists.boost.org Return-Path: boost-users-bounces@lists.boost.org X-OriginalArrivalTime: 29 Sep 2006 16:14:11.0441 (UTC) FILETIME=[4CA19610:01C6E3E2] On 9/29/06, Andrei Danaila
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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users