Try this

Click to reveal..
Code:
//--------------------------------------------------------------------
var txt_for_bigdir(TEXT* txt, STRING* name)
{	if((!txt)||(!name))		return(0);	//invalid parameter/s
	//-----------------------------------------------------------------
	var i, old_len=txt.strings, count;	
	// Automatically flush out all old populated strings
	for(i=0; i<txt.strings; i++)			if((txt.pstring)[i])		
	{	str_remove((txt.pstring)[i]);		(txt.pstring)[i]=0;		}	
	// retrieve directory and verify we got it ALL
	while((count=txt_for_dir(txt,name))==old_len)	//if too small?
	{	//clear strings again AND double TXT.strings size at the time
		for(i=0; i<old_len;	i++)	{	txt_addstring(txt, NULL);
			if((txt.pstring)[i])		{	str_remove((txt.pstring)[i]);
												(txt.pstring)[i]=0;				}	}
		old_len = txt.strings;														}
	//-----------------------------------------------------------------
	return(count);
}
//--------------------------------------------------------------------



Use it in EXACTLTY the same way as you would use txt_for_dir.
But if the TXT is too small it gets auto-extended, and any existing
strings in the array will be wiped clean.

Warning! If it DOES get extended, or the TXT you supplied was too long,
there MAY be unused strings at the end of the TXT.
EG: If you retrieve a directory of 13 items, the TXT may actually be 16 long.

Always rely on the VAR that is returned. It IS an accurate count of how many
filenames were retrieved.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial