c++ - Compiler error when calling connect(2) with sockaddr_un -
i making simple call connect(2), in c++ program. code is:
connect(socket_fd, (struct sockaddr *)&name, sun_len(name));
(here, name
struct sockaddr_un
).
when try compile this, following error g++:
error: base operand of '->' has non-pointer type 'sockaddr_un'
i totally baffled this, because i'm not using -> operator anywhere in program! there wrong way i'm taking address of name
, or way casting it?
the macro sun_len
expects passed structure pointer, should use sun_len(&name)
.
Comments
Post a Comment