Thanks
ms.Seek(0,0);
> DisplayMemo.Lines.Add(ms.DataString);
Works great. It looks like ms.Seek is quit important sometimes. In case of
using TMemoryStream its needed, TStringStream not all the time.
> > ms:=TStringStream.Create(data);
When using TStringStream.Create('') it's the same, seems like the var 'data'
has no meaning here.
Thanks for your help
Werner
----- Oorspronkelijk bericht -----
Van: "Guillaume MAISON" <[EMAIL PROTECTED]>
Aan: "ICS support mailing" <[email protected]>
Verzonden: dinsdag, oktober 04, 2005 11:57
Onderwerp: Re: [twsocket] ftp to Table
> >
> > I have a small file located on a FTP
> > I want to read this file, line per line, and save this data direct to a
> > local table.
> > So I don't need to save this file first to disk, and read it again.
> >
> > I took a look at the localSteam property, and tried this example.
> > The ms.Size give a number, but I can't get the stream into data?
> >
> > var
> > ms:TStringStream;
> > data:string;
> > begin
> > ms:=TStringStream.Create(data);
> > try
> > FtpClient1.HostName := HostNameEdit.Text;
> > FtpClient1.Port := PortEdit.Text;
> > FtpClient1.UserName := UserNameEdit.Text;
> > FtpClient1.PassWord := PassWordEdit.Text;
> > FtpClient1.HostDirName := HostDirEdit.Text;
> > FtpClient1.HostFileName := HostFileEdit.Text;
> > FtpClient1.LocalStream := ms;
> > FtpClient1.Binary := True;
> > FtpClient1.Receive;
> > DisplayMemo.lines.Add('Memorystream '+IntToSTr(ms.Size));
>
> > DisplayMemo.Lines.Add(data);
> You should replace this line by :
>
> ms.Seek(0,0);
> DisplayMemo.Lines.Add(ms.DataString);
>
> > finally
> > ms.Free;
> > end;
> > end;
>
> HTH,
>
> Best regards,
>
> --
>
> Guillaume MAISON - [EMAIL PROTECTED]
> 83, Cours Victor Hugo
> 47000 AGEN
> Tél : 05 53 87 91 48 - Fax : 05 53 68 73 50
> e-mail : [EMAIL PROTECTED] - Web : http://nauteus.com
>
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be