In GTK it is a struct with 2 int, so it will work.

  In Motif we have to parse, and transfer to another structure, so it is
not done in the same way.

Best,
Scuri


Em qui, 16 de jul de 2020 20:08, Ranier Vilela <ranier_...@hotmail.com>
escreveu:

> De: Antonio Scuri <antonio.sc...@gmail.com>
> Enviado: quinta-feira, 16 de julho de 2020 22:36
> Para: IUP discussion list.
> Assunto: Re: [Iup-users] IUP assorted issues (part IV)
>
> >  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
> Oh yes, OK.
>
> >  But it is system dependent. Because "long" in Visual C++ will be the
> same as "int".
> >  In which system did you test?
> http://cpp.sh/
>
> With long type, works.
>
> #include <stdio.h>
>
> typedef struct CPOINT {
>     long x;
>     long y;
> } POINT, *PPOINT;
>
> void cast_to_point(long * 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()
> {
>     long 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=180
> cpoints[0]->y=50
> cpoints[1]->x=180
> cpoints[1]->y=20
> cpoints[2]->x=230
> cpoints[2]->y=70
>
> Maybe, can changed to long?
> Is secure to GTK and Motif?
>
> regards,
> Ranier Vilela
>
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to