This is the output here: cpoints[0]->x=180 cpoints[0]->y=50 cpoints[1]->x=180 cpoints[1]->y=20 cpoints[2]->x=230 cpoints[2]->y=70
But it is system dependent. Because "long" in Visual C++ will be the same as "int". In which system did you test? Best, Scuri Em qui., 16 de jul. de 2020 às 17:55, Ranier Vilela <[email protected]> escreveu: > De: Antonio Scuri <[email protected]> > Enviado: quinta-feira, 16 de julho de 2020 19:00 > Para: IUP discussion list. > Assunto: Re: [Iup-users] IUP assorted issues (part IV) > > > Yes, there are two integers there. And we provide an array with twice > the size, but count still contains just the >number of points. It is > correct. > IMHO, I can't see how this can work. > > #include <stdio.h> > > typedef struct CPOINT { > long x; > long y; > } POINT, *PPOINT; > > > void cast_to_point(int * ipoints, int count) > { > POINT * cpoints; > int i; > > cpoints = (POINT*) ipoints; > for(i = 0; i < count; ++i) { > printf("cpoints[%d]->x=%ld\n", i, cpoints[i].x); > printf("cpoints[%d]->y=%ld\n", i, cpoints[i].y); > } > } > > int main() > { > int ipoints[6]; > > ipoints[0] = 180; > ipoints[1] = 50; > ipoints[2] = 180; > ipoints[3] = 20; > ipoints[4] = 230; > ipoints[5] = 70; > > cast_to_point(ipoints, 3); > } > > output: > cpoints[0]->x=214748364980 > cpoints[0]->y=85899346100 > cpoints[1]->x=300647710950 > cpoints[1]->y=0 > cpoints[2]->x=0 > cpoints[2]->y=135050311015237 > > I think is better declare a struct point for the IUP use. > > typedef struct IUP_POINT { > long x; > long y; > } point_t,; > > regards, > Ranier Vilela > > _______________________________________________ > Iup-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/iup-users >
_______________________________________________ Iup-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/iup-users
