Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can only access 1022 array elements at a time from FLL
Message
From
03/08/2004 09:09:13
 
 
To
02/08/2004 21:05:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00930231
Message ID:
00930309
Views:
8
Hi Paul,

I'm guessing that the array is array of strings, right ? If so, your program is run out of stack! _Load() function automatically create a handle but you have to FREE it your self. Look at _Load API example at VFP help.

For _HLock() it is safer to use it because a pointer returned by _HandToPtr() may become invalid anytime (you will not know when).

Regards


>I have written a program in C++ (below) that scans a 27000-element VFP string array. This program bombs after reading 1022 array elements. It doesn't matter where you start in the array. If you tell it to start at 5000, it will bomb at 6021. The pointer to the string becomes null.
>Any help would be greatly appreciated. This is actually getting bad for my health.
>
>
>// Probe search
>//
>// Parameters passed:
>// 1 probe string array (by reference)
>// 2 consensus string (by value)
>void FAR fllProbeSearch(ParamBlk FAR *parm)
>{
>
>	long arraypos, probeArrayLen; // Starting value of Loop (index into array)
>	int		probeno;             // probe number
>	int     probepos;            // position of probe in array string
>	Value   val;                 // Create Value structure.
>	Locator probearr_locator;    // Create Locator structure for probe[].
>	char FAR * probesetstring;   // points to one string in the probeset array
>	int probesetlen = 0;         // the length of a probesetstring
>
>	char Message[801];           // holds debug messages for output
>	char probeseq[26];           // holds an individual probe sequence for use by strstr()
>
>	char FAR * seq = NullTerminate1(&parm->p[1].val);	// consensus sequence  (have to get it from VFP)
>	char revseq[14000];                // buffer for flipped sequence
>    int seqlen;					 // length of consensus sequence
>
>	int subgoodFwd, subgoodRev;   // holds the number found fwd, rev
>	char vname[11];				// for var name passed to putNumVar
>
>
>	_PutStr("Step 1");
>
>	_Load(&parm->p[0].loc, &val);
>
>
>//    &parm->p[2].val.ev_type = 'L';
>
>	probearr_locator = parm->p[0].loc; // Store the contents of the FoxPro array in the Locator structure.
>	probearr_locator.l_subs = 1;       // Must be set to 1 for one dimensional array
>
>	probeArrayLen = _ALen(parm->p[0].loc.l_NTI, AL_ELEMENTS);   // get array length (# of elements)
>
>	sprintf( Message, "\nsubscripts %u  p[2].val.ev_type = %c\n", probeArrayLen, parm->p[2].val.ev_type);
>	_PutStr( Message );   //print the message
>
>
>	// ---- FOR loop to get the array elements. ----
>        // This loop dies after 1022 times.  You can set the starting
>        // arraypos higher and it will still die after 1022 times.
>	for(arraypos=0; arraypos < probeArrayLen ; arraypos ++){
>
>		probearr_locator.l_sub1 = (arraypos+1);
>
>        _HLock(val.ev_handle);  // Do I need this here?
>		/* Store the contents of an individual FoxPro array element into a Value Structure.*/
>		_Load(&probearr_locator,&val);
>
>		probesetstring = (char FAR *) _HandToPtr(val.ev_handle);  // get a pointer to the string (goes to null after 1022 loops)
>		probesetlen    = val.ev_length;
>
>		sprintf( Message, " %u ", arraypos);  // this goes from 0 to 1021 and fails with a null pointer
>		_PutStr( Message );
>
>		if (probesetstring == 0) _UserError("probesetstring pointer is null");
>
>// --- Lots of inner loop stuff would go here
>
>		_HUnLock(val.ev_handle);    // Do I need this here?
>
>
>	}  // bootom of probe array scan loop
>}
>
>FoxInfo myFoxInfo[]={
>  {"fllProbeSearch",(FPFI)fllProbeSearch,3,"RCL"},
>};
>
>
>extern "C" {
>FoxTable _FoxTable={
>      (FoxTable FAR*)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo };
>}
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform