首页 > 其他 > 详细

通过 void *handel传到参数

时间:2021-08-19 17:22:25      阅读:35      评论:0      收藏:0      [点我收藏+]

 

通过 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;
}

 

通过 void *handel传到参数

原文:https://www.cnblogs.com/adong7639/p/15161835.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!