🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17303

Re: Problem in deleting file!

#17303
From: Safari
Date: Fri, 28 Mar 2003 11:02
52 lines
2469 bytes
Thanks Mr. Dear Remy,
Can not i use "char *Path" and ".pFrom = Path"?
Safari

Remy Lebeau (TeamB) wrote:
> "Safari" <Safari@alloymail.com> wrote in message
> news:3E8408FF.5040308@alloymail.com...
> 
> 
>>    hFile.pFrom  = hPath;
> 
> 
> The pFrom and pTo members must be double-null terminated, but you're not
> providing a second null terminator at all.  Try this instead:
> 
>     bool __fastcall RemoveFile(AnsiString Path)
>     {
>         Path += '\0';
> 
>         SHFILEOPSTRUCT hFile = {0};
>         hFile.wFunc  = FO_DELETE;
>         hFile.pFrom  = Path.c_str();
>         hFile.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
>         return SHFileOperation(&hFile);
>     }
> 
>     void __fastcall TMain::BitBtn4Click(TObject *Sender)
>     {
>         for (int a = ListView->Items->Count - 1; a >= 0; a--)
>         {
>             TListItem *Item = ListView->Items->Item[a];
>             RemoveFile(Item->Caption);
>             Item->Delete();
>         }
>     }
> 
> Or, just use DeleteFile() instead:
> 
>     void __fastcall TMain::BitBtn4Click(TObject *Sender)
>     {
>         for (int a = ListView->Items->Count - 1; a >= 0; a--)
>         {
>             TListItem *Item = ListView->Items->Item[a];
>             DeleteFile(Item->Caption);
>             Item->Delete();
>         }
>     }
> 
> 
> Gambit
> 
> 
Technical Details
Message-ID: <3E842BD0.1060302@alloymail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3E8408FF.5040308@alloymail.com> <3e840eac$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5fde27ba165b16db
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-28 03:18:32 PST
Message-ID: <3E842BD0.1060302@alloymail.com>
Date: Fri, 28 Mar 2003 15:32:40 +0430
From: Safari <Safari@alloymail.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Problem in deleting file!
References: <3E8408FF.5040308@alloymail.com> <3e840eac$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.28.33.83
X-Trace: newsgroups.borland.com 1048849365 81.28.33.83 (28 Mar 2003 03:02:45 -0800)
Lines: 53
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail