通过 void *handel传到参数

 

通过 void *handel传到参数

 

typedef struct
{
    int a;
    uchar *ptr;
}EffectParam;


void fun(void* handle)
{
    //if (handle != NULL)
    //{
    //    cout << "handle " << handle << endl;
    //}
    EffectParam *param = (EffectParam*)handle;
    cout << param->a << endl;
    if (param->ptr != NULL)
    {
        cout << "param->ptr " << param->ptr << endl;    
    }
}

void funtest()
{
    EffectParam param;
    param.a = 3;
    param.ptr = new uchar[3];
    void* handel = &param;
    fun(handel);
}


int main()
{
    funtest();
    return 0;
}

 

posted on 2021-08-19 15:04  Maddock  阅读(130)  评论(0编辑  收藏  举报

导航