 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mr. Wuf Guest
|
Posted: Sun Jan 29, 2006 6:40 pm Post subject: MIME Encoding and TFileStream error |
|
|
Hello,
why does this code not work? Error: Stream read error
TFileStream *FStream = new TFileStream("C:\somefile.xyz", fmOpenRead ||
fmShareDenyWrite);
String SndText = IdEncoderMIME1->Encode(FStream, FStream->Size);
delete FStream;
Where is the problem?
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Sun Jan 29, 2006 8:18 pm Post subject: Re: MIME Encoding and TFileStream error |
|
|
Mr. Wuf wrote:
| Quote: | why does this code not work? Error: Stream read error
|
fmOpenRead || fmShareDenyWrite
You should bitwise construct the Mode parameter:
fmOpenRead | fmShareDenyWrite
Hans.
|
|
| Back to top |
|
 |
Mr. Wuf Guest
|
Posted: Mon Jan 30, 2006 9:14 am Post subject: Re: MIME Encoding and TFileStream error |
|
|
Sorry, my next problem: I need to transfer a binary file as a string. When I
decode the base64 string to a TFileStream I get corrupted files!
TFileStream *FStream = new TFileStream("C:\test.png", fmCreate |
fmOpenReadWrite);
IdDecoderMIME1->DecodeToStream(Memo1->Text,FStream);
// FStream->Size = 130677; // original filesize: 130677, size of corrupted
file: 140768
delete FStream;
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Mon Jan 30, 2006 10:04 am Post subject: Re: MIME Encoding and TFileStream error |
|
|
Mr. Wuf wrote:
| Quote: | Sorry, my next problem: I need to transfer a binary file as a string. When I
decode the base64 string to a TFileStream I get corrupted files!
|
Seeing your code you mean: I did base64 encode the contents of a file. And
no I try to decode it to a stream.
| Quote: | TFileStream *FStream = new TFileStream("C:\test.png", fmCreate |
fmOpenReadWrite);
IdDecoderMIME1->DecodeToStream(Memo1->Text,FStream);
// FStream->Size = 130677; // original filesize: 130677, size of corrupted
file: 140768
delete FStream;
|
Corrupted ? It is longer yes. But what do contain the first 130677 bytes ?
The original file contents ?
What is in the result file ? Dit you look in it ?
Hans.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|