酒店管理专业发展计划:有关于connect返回值问题

来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 04:14:53
例程:   unsigned char status;      status = connect( stxvideo, (PSA) &sin_server, sizeof(sin_server) );
     if( status< 0 ){
           printf("failed video connect (error code:%d)\n",fdError()); 
      }else{
         printf("video connect successful\n" );
      }此例程错误,因为If connect( ) succeeds, the function returns 0. Otherwise, a value of -1 is returned and the  function fdError() can be called to determine the error 而status定义的是无符号的