Writing strings to file!! TStreamFile
From: Carlos (carlos_at_aol.com)
Date: 10/27/03
- Next message: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Previous message: Michael Domke: "Re: HELP! Internal Error: URW2031"
- Next in thread: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Reply: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Oct 2003 07:02:23 -0700
Hi,
I need to create a file image from data being receiving from a socket connection. The data are basicaly strings, with some special characteres used as control tags (ASCII < 31)
What I did (this is a simple example to understand what I need):
var img:TStreamFile; <-- at the begining the code
.
.
.
img := TStreamFile('img.tmp',fmCreate); <-- create stream file
.
.
.
procedure TForm1.Socket1Read(Sender: TObject; Socket: TCustomWinSocket);
var tmp:string;
begin
tmp := Clt.Socket.ReceiveText; <- receiving as text
img.WriteBuffer(tmp,length(tmp)); // write data to the file
if Pos(EOT,tmp) then
begin
img.Free; // close the file
exit;
end;
end;
I am using the basic TSocket from D5. The problem is because the file gets wrong, not the image. It writes other binary data that doesn't correspond from the receiving data.
I did such code using BlockWrite with the same problem.
I would appreciate any help!! :(
Thank you all!
- Next message: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Previous message: Michael Domke: "Re: HELP! Internal Error: URW2031"
- Next in thread: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Reply: Kurt Barthelmess: "Re: Writing strings to file!! TStreamFile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|