SET LIBRARY TO test DIMENSION bb[2] bb[1] = REPLICATE('a',25) bb[2] = REPLICATE('b',25) ? '--- ARRAY AS SEEN BY VFP ---' ? bb[1] && aaaaaaaaaaaaaaaaaaaaaaa ? bb[2] && bbbbbbbbbbbbbbbbbbbbbbb ? '---- ARRAY AS SEEN BY FLL ---' byref_array(@bb) SET LIBRARY TO returnC++ CODE -----------------------
//test.cpp #include pro_ext.h // I had to take the greater than/less than off #include stdio.h // these to show them here on the web. #include string void FAR ByRef_array(ParamBlk FAR *parm) { int start; // Starting value of Loop (index into array) Value val; // Create Value structure. Locator loc; // Create Locator structure. char FAR * probesetstring; int probesetlen; char Message[801]; _Load(&parm->p[0].loc, &val); loc = parm->p[0].loc; /* Store the contents of the FoxPro array in the Locator structure. */ /* Get the number of elements from the FoxPro array. */ loc.l_subs = (int)_ALen(parm->p[0].loc.l_NTI, AL_ELEMENTS); sprintf( Message, "\nsubscripts %u \n", loc.l_subs); _PutStr( Message ); //print the message /* ---- FOR loop to get the array elements. ---- */ for(start=0;start != loc.l_subs ; start ++){ _PutStr( "-- Top of Loop -- " ); loc.l_sub1 = (start+1); /* Store the contents of the FoxPro array into a Value Structure.*/ _Load(&loc,&val); // this one doen't seem to do anything, still gets the first array member probesetstring = (char FAR *) _HandToPtr(val.ev_handle); // get a pointer to the string probesetlen = (int) val.ev_length; sprintf( Message, "\ntype %c length %u %s \n", val.ev_type, probesetlen, probesetstring ); _PutStr( Message ); //print the message } } FoxInfo myFoxInfo[]={ {"ByRef_ARRAY",(FPFI)ByRef_array,1,"R"}, }; extern "C" { FoxTable _FoxTable={ (FoxTable FAR*)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo }; }