Article View: borland.public.cppbuilder.nativeapi
Article #17149Re: Split file.
From: Remy Lebeau (TeamB)
Date: Mon, 07 Apr 2003 17:24
Date: Mon, 07 Apr 2003 17:24
45 lines
2514 bytes
2514 bytes
"Safari" <Safari@alloymail.com> wrote in message
news:3E91A68B.8000503@alloymail.com...
> I wrote this code before your answer,
> return me "Stream File Error..."
> Where is my mistake?
You didn't indicate where in the code the error is actually coming from, or
what the full error message was. Please always be more specific when
reporting errors. However, there are a few problems with your code that is
preventing it from working correctly.
> BYTE hBufer[1];
This is not a problem, just a comment - you don't need a 1-element array for
that:
BYTE hBufer;
...
hSource->ReadBuffer(&hBufer, 1);
hTarget->WriteBuffer(&hBufer, 1);
> while ((b = hBytes) | (b > hSource->Size));
You're using the wrong operator in there. You should be using ||, not |.
Why are you comparing the sizes like that? I think you have your loop
comparisons mixed up. I looks like you're assuming that the loop will
continue until one of those conditions becomes 'true', while is not the
actual case. Are you coming from a VB background, by chance? Your
comparisons should be more like this instead:
while ((b != hBytes) && (b < hSource->Size));
I'm assuming hBytes is the number of bytes you want each split chunk file to
be? Why are you splitting the file one byte at a time instead of in larger
chunks to begin with? You're going to cause a lot of unnecessary overhead
with file I/O doing it that way.
Was there some problem preventing you from using the code I gave you
earlier?
Gambit
Technical Details
Message-ID:
<3e91b462$1@newsgroups.borland.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-mailReferences:
<3E8F1D05.40008@alloymail.com> <3e8f69e0@newsgroups.borland.com> <3E91A68B.8000503@alloymail.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-07 10:27:33 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3E8F1D05.40008@alloymail.com> <3e8f69e0@newsgroups.borland.com> <3E91A68B.8000503@alloymail.com> Subject: Re: Split file. Date: Mon, 7 Apr 2003 10:24:03 -0700 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3e91b462$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049736290 207.175.226.26 (7 Apr 2003 10:24:50 -0800) 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