IdFtp using C++ (errors)

Giganews Newsgroups
Subject: IdFtp using C++ (errors)
Posted by:  Joe Pool (jpo…@letourneau-inc.com)
Date: Tue, 6 Sep 2005

I have created a basic project that is giving me errors.  I do not
understand why I am getting the errors, and I would like to know how to
correct it:

Here is my "Borland C++ Builder 6" code (with line numbers added in):

  01. void __fastcall TForm1::FormCreate(TObject *Sender)  {
  02.  bool bRet;
  03.  int iPos;
  04.  TStringList* List1;
  05.  IdFtp1->Username = "anonymous";
  06.  IdFtp1->Password = "te…@anonymous.com";
  07.  IdFtp1->Host = ftp://companyftpsite.com;
  08.  IdFtp1->Connect(true);
  09.  if (IdFtp1->RetrieveCurrentDir().Pos("LogViewer") > 0)  {
  10.    bRet = true;
  11.  } else {
  12.    IdFtp1->ChangeDir("LogViewer");
  13.    if (IdFtp1->RetrieveCurrentDir().Pos("LogViewer") > 0)
  14.      bRet = true;
  15.  }
  16.  if (bRet == true)  {
  17.    IdFtp1->List(List1, "*.*", true);
  18.  }
  19.  iPos = List1->IndexOf("LogViewer");
  20. }

I consistantly receive an error whenever I attempt to list the contents of
the directory (line #17).  Here is the error:

MessageBox(NULL, "Project Project1.exe raised exception class
EAccessViolation with message 'Access violation at address 00000000. Read of
address 00000000'. Process stopped. Use Step or Run to continue.", "Debugger
Exception Notification", MB_OKHELP | MB_ICONSTOP);

If someone could please tell me why this continues to fail, I would
certainly appreciate it.

Replies