res=mysql_store_result(&mysql);
if (res==NULL)
{
printf("mysql_restore_result(): %s\n", mysql_error(&mysql));
break;
}
rows = mysql_num_rows(res);
printf("The total rows is: %d\n", rows);
fields = mysql_num_fields(res);
printf("The total fields is: %d\n", fields);
printf("表中的資料:\n");
int j=0;
char sendbuf[200];
while((row=mysql_fetch_row(res)))
{
for(int i=0;i<fields;i++)
{
printf("\t%s\t",row[i]);
sendbuf[j++] = row[i];
}
printf("\n");
write(fd,sendbuf,j);
}

上面代碼的編譯后對于“ sendbuf[j++] = row[i];”會有如圖的警告,這是我寫的服務器端的一部分代碼,想把資料庫表中的資料發送到客戶端,通過上面的代碼,客戶端接收的資料顯示不出來。所以想請教一下各位有沒有什么解決方法,謝謝了。
uj5u.com熱心網友回復:
看報錯,好像是型別不匹配轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/81789.html
標籤:MySQL
