06-12-2023, 11:11 PM
(This post was last modified: 06-12-2023, 11:13 PM by Kernelpanic.)
Quote:@Terry - The Library is written in C++ and I figured by using DECLARE LIBRARY I could get this done. However, my C++ knowledge is lacking as well. Trying to figure out where pointers are used versus variables, . . .@Terry - just in case you want to try something like this, pointers are created like this in C/C++:
int *zgr, **zzgr; (**zzgr is a pointer to a pointer. Yes, you can do that in C, ad nauseam.)
Here is an old example program that flips a number and a character array. - With zzgr = &zgr the pointer-to-pointer is assigned the address of zgr. The pointer then moves backwards through the field (zgr--), and **zzgr displays it. Hope that's halfway understandable.
Code: (Select All)
#include <stdio.h>
#include <stdlib.h>
#define MAX 9
int main(void)
{
int feld[] = { 1,2,3,4,5,6,7,8,9 };
char char_feld[] = { 'a','b','c','d','e','f','g','h','z' };
int i, *zgr, **zzgr;
char *char_zgr, **cchar_zgr;
for ( i = 0; i < MAX; i++ )
{
zgr = &feld[i];
printf("%d ", *zgr);
}
printf("\t");
for ( i = 0; i < MAX; i++ )
{
char_zgr = &char_feld[i];
printf("%c ", *char_zgr);
}
printf("\n\n");
//Mit zzgr = &zgr wird dem Zeiger-auf-Zeiger die Adresse
//von zgr zugewiesen. Der Zeiger zgr geht dann rückwärtz
//das Feld durch (zgr--), und **zzgr läßt es anzeigen.
for ( i = 0; i < MAX; i++ )
{
zzgr = &zgr;
printf("%d ",**zzgr);
zgr--;
}
printf("\t");
for ( i = 0; i < MAX; i++ )
{
cchar_zgr = &char_zgr;
printf("%c ", **cchar_zgr);
char_zgr--;
}
return(0);
}
If you want to compile the program yourself, it says in the screenshot.