【发布时间】:2011-10-02 23:02:51
【问题描述】:
我有一个包含结构的无符号字符指针。现在我想做以下事情
unsigned char *buffer ;
//code to fill the buffer with the relavent information.
int len = ntohs((record_t*)buffer->len);
其中 record_t 结构包含一个名为 len 的字段。我无法这样做并收到错误。
error: request for member ‘len’ in something not a structure or union.
我在这里做错了什么?
【问题讨论】:
-
请注意,标准保留以
_t结尾的名称以供将来使用。 -
基本上是 compilation error: request for member in something not a structure or union 的副本,因为一元
*与演员表具有相同的优先级。始终使用 Google 搜索您的错误消息。
标签: c pointers gcc gcc-warning