没有分配内存?!
用P_THREAD_STRU pthread_str =new P_THREAD_STRU ;试试

解决方案 »

  1.   


    pthread_str->new_fd=new_fd;
    前加上
    pthread_str =new THREAD_STRU;
      

  2.   

    各位大哥,我的程序是用C写的,在Linux下,而且在其他程序中我也是这样定义的,我用malloc()分配了内存还是到哪儿就死掉了,各位在给点建议吧
      

  3.   

    typedef struct
    {
            unsigned int new_fd;
            char * client_ip;//这样定义
    }THREAD_STRU,*P_THREAD_STRU;..............
    char client_ip[20];
    strcpy(pthread_str->client_ip,client_ip);
      

  4.   

    或者
    char client_ip[20];
    ..............
    strcpy((char *)pthread_str->client_ip,(char *)client_ip);
      

  5.   

    我到这一不就死掉了:pthread_str->new_fd=new_fd;我觉得定义为数组与指针没什么区别呀!我在仔细看看!