SWIG/python array inside structure

前端 未结 3 1781
南方客
南方客 2020-12-01 22:01

I\'ve got a structure defined inside header.h that looks like :

typedef struct {
....
    int      icntl[40];
    double   cntl[15];
    int      *irn, *jcn;         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 22:44

    I would have done this in python

    ptr = int(st.icntl)
    import ctypes
    icntl = ctypes.c_int * 40
    icntl = icntl.from_address(ptr)
    
    print icntl[0]
    icntl[0] = 1
    for i in icntl:
        print i 
    

提交回复
热议问题