🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Split file.

#17074
From: Safari
Date: Sat, 12 Apr 2003 03:46
44 lines
2475 bytes
Remy Thanks^(n+1),
Your source here is, work very fine & success.

void __fastcall TMain::BitBtn1Click(TObject *Sender)
{
    int iSourceFile = FileOpen(Edit1->Text, fmOpenRead
    | fmShareDenyWrite);
    if(iSourceFile != -1)
    {
       BYTE hBuf[50000];
       int iNum = 1;
       do
       {
          int iRead = FileRead(iSourceFile, hBuf, 50000);
          if(iRead != -1)
          {
             if(iRead == 0) break;
             AnsiString ext = Format("%.3d", ARRAYOFCONST((iNum)));
             ++iNum;
             int iNewFile = FileCreate(Edit2->Text + ext);
             if(iNewFile != -1)
             {
                if(FileWrite(iNewFile, hBuf, iRead) != iRead)
                FileClose(iNewFile);
             }
          }
       }
       while(true);
       FileClose(iSourceFile);
    }
}

Remy Lebeau (TeamB) wrote:
 > "Safari" <Safari@alloymail.com> wrote in message
 > news:3E955473.6000807@alloymail.com...
  >
 > No, you're not.  I've posted my code twice for you now, but your code, as
 > you've posted it here, still does not resemble my code at all. 
You're off
 > doing your own things.  My code does not use TFileStream and sets aside a
 > fixed-sized buffer and then read/wrote the files in full 50000b 
blocks at a
 > time.  Your code, on the other hand, is using TFileStream and is
 > reading/writing the files one byte at a time instead.
Technical Details
Message-ID: <3E978BF8.6010606@alloymail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3E8F1D05.40008@alloymail.com> <3e8f69e0@newsgroups.borland.com> <3E955473.6000807@alloymail.com> <3e9619fe$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,8f5102c5a422c5bb
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-11 21:02:47 PST
Message-ID: <3E978BF8.6010606@alloymail.com>
Date: Sat, 12 Apr 2003 08:16:00 +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: Split file.
References: <3E8F1D05.40008@alloymail.com> <3e8f69e0@newsgroups.borland.com> <3E955473.6000807@alloymail.com> <3e9619fe$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.28.33.79
X-Trace: newsgroups.borland.com 1050119894 81.28.33.79 (11 Apr 2003 20:58:14 -0700)
Lines: 45
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail