Re:FTP ChangeDir, Makedir
[This followup was posted to borland.public.delphi.internet.winsock and
a copy was sent to the cited author.]
In article <3bc4a973_2@dnews>, brainw...@{*word*104}junkie.dk says...
Quote
> How do i use the commands ChangeDir(), Makedir() ?
> becuse if i do changedir() to check if directory exists, i get a dumb
> dialog, and cant
> trap the error so i know dir does not exist so i can create it,..
> HOW DO I HANDLE ERRORS????
> ICS you would get a nice result from Function or Exception.. here nothing
> works..
It does work if you understand how to use exceptions.
For FTP commands, you would do something like this:
try
IdFTP1.ChangeDir('pub');
except
on E : EIdProtocolReplyError do
begin
//whatever - such as using the classe's protocol error such as this:
//note that these numbers are in RFC 959
case E.ReplyErrorCode of
500 : Memo1.Lines.Add('Syntax error');
550 : //whatever such as make directory
end;
end;
end;
I would suggest you read the Object Pascal Reference section about
raising and handling exceptions. Exceptions are not evil and are useful
if you understaned them.
--
Support the anti-Spam amendment - Join at http://www.cauce.org/
J. Peter Mugaas E-Mail: oma00...@mail.wvnet.edu
http://wvnvm.wvnet.edu/~oma00215/ ICQ Number: 14297043
Finger for PGP Key