我有上述錯誤request member rv in something not a structure of union
。我GOOGLE了它和幾個答案告訴我一個指針工作時,它可是嘗試訪問它作爲一個結構,我應該使用的->
代替.
編譯錯誤:請求成員的東西不是工會的結構
int foo(void * arg, struct message * msg)
{
struct fd_info * info = (struct something *) arg;
struct client * csys = info->c_sys;
int * socks[MAX_CONNECTION];
int rv;
socks = &(info->_socks); // where int * _socks[MAX_CONNECTION] in struct info
// do other things
rv = sendto(socks[i], msg, sizeof(msg), NULL, &(csys->client_address), sizeof(csys->client_address));
...
}
的問題是所有的論點,我有是指針。我很困惑什麼是錯的。感謝任何意見/想法。
編輯: 對不起&味精,它最初只是味精,但在我絕望的嘗試,我正在嘗試的東西。 添加了rv的定義。
是否缺少一些正確的語法,它說 – WhirlWind 2010-04-07 00:57:26
請顯示'rv'的定義 – 2010-04-07 00:57:55
此外,'csys'的定義可能會有所幫助。 – 2010-04-07 01:12:29