Thread View: borland.public.cppbuilder.internet.socket
5 messages
5 total messages
Started by Mr. Wuf
Sun, 29 Jan 2006 18:40
MIME Encoding and TFileStream error
Author: Mr. Wuf
Date: Sun, 29 Jan 2006 18:40
Date: Sun, 29 Jan 2006 18:40
10 lines
1187 bytes
1187 bytes
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?
Re: MIME Encoding and TFileStream error
Author: Hans Galema
Date: Sun, 29 Jan 2006 20:18
Date: Sun, 29 Jan 2006 20:18
11 lines
1264 bytes
1264 bytes
Mr. Wuf wrote: > why does this code not work? Error: Stream read error fmOpenRead || fmShareDenyWrite You should bitwise construct the Mode parameter: fmOpenRead | fmShareDenyWrite Hans.
Re: MIME Encoding and TFileStream error
Author: Mr. Wuf
Date: Sun, 29 Jan 2006 20:26
Date: Sun, 29 Jan 2006 20:26
1 lines
1029 bytes
1029 bytes
Thank you Hans!
Re: MIME Encoding and TFileStream error
Author: Mr. Wuf
Date: Mon, 30 Jan 2006 09:14
Date: Mon, 30 Jan 2006 09:14
9 lines
1364 bytes
1364 bytes
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;
Re: MIME Encoding and TFileStream error
Author: Hans Galema
Date: Mon, 30 Jan 2006 10:04
Date: Mon, 30 Jan 2006 10:04
20 lines
1901 bytes
1901 bytes
Mr. Wuf wrote:
> 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.
> 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads