[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: revisiting the ftp_list problem
Sender: "Richard B Baird" <rbaird@xxxxxxxxxxxxxxxxxxxxx>
Scott,
> Believe it or not, I put a lot of thought into the design of FTP_list :)
I believe you. But i don't have pointer access to your brain... ;)
> It's legal. The one thing that I do want to clarify, however, is that
> YOU must allocate the memory that FTP_list will be using. It does not
> allocate it for you.
this is where all this stuff get's fuzzy for me. is it because once the
procedure is finished, and I haven't allocated it before hand, it becomes
volitile?
> > You used the phrase "the pointer returned by FTP_list" and I just want
to
> > make sure we don't have a misunderstanding here. FTP_list does not
> > return a pointer. You give it an input-only pointer, which it uses to
> > determine where to store the entries returned from the server.
it's the pointer I provide of the memory i've allocated, (whether by ALLOC
or defining the array) rather than one that it gives back to me... got it.
> If you decide to use a pointer, and you wish to allow FTP_list to return
> up to 32767 entries, then you must allocate 256 * 32767 bytes for
FTP_list
> to use with the ALLOC op-code. And you must call DEALLOC when you're
> done with that memory.
> As long as you do that, your method will work nicely.
so, to do it properly, run ftp_list once with a nbr of entries to retrieve
(y) = 1, just to get the total number of entries found (x), then allocate
memory for (x * 256) + 2560 (to account for any additional files that might
have been added at that moment), call again and with y = x + 10 to get the
actual file names into memory, read them by incrementing my pointer field
as described before, and when done, DEALLOC the memory.
Right?
Thanks again,
rick
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------