struct com_department_c sCom_department;
memset(&sCom_department,0x00,sizeof(sCom_department));
/*wrk_sts去tbl_col_sele表中找对应汉语意思*/
char cWrk_sts[2];
memset(cWrk_sts,0x00,sizeof(cWrk_sts));
/*cWrk_sts[0]=sCom_department.wrk_sts[0];*///1
/*sprintf(cWrk_sts,"%s",sCom_department.wrk_sts[0]);*错误*///2
/*strncpy(cWrk_sts,sCom_department.wrk_sts,1);*//3
memcpy(cWrk_sts,sCom_department.wrk_sts,1);//4
-----------------------------------------------------------------------------------------------------------------
字符串赋值一般用函数赋值
常见的函数有strcpy strncpy memcmp sprintf等等。
但是strcpy sprintf 只能写入整个字符串。不能取出取出其中第一位。
这里我们可以采用三四 取第一位。函数用法。
但是如果娶的不是第一位只能用1来实现。
虽然cWrk_sts[0]=sCom_department.wrk_sts[0] 能直接赋值,但是不能直接使用。只能使用字符串。如能使用cWrk_sts 但不能使用cWrk_sts[0].
iRet=Tbl_col_sele_Sel(g_pub_tx.reply,&sTbl_col_sele,"tab_name='com_department'and col_name='wrk_sts'and item_no='%s'",cWrk_sts);
iRet=Tbl_col_sele_Sel(g_pub_tx.reply,&sTbl_col_sele,"tab_name='com_department'and col_name='wrk_sts'and item_no='%s'",cWrk_sts[0]);
第二句cWrk_sts【0】是没有值得。