#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
int main(void) {
struct sockaddr_in address;
sizeof(sockaddr);
return 0;
}
GCC 3.2 bug?
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Whoops, that''s a typo. It does say struct sockaddr in my C file. Says that length of address isn''t known at compile time.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Now sizeof(struct sockaddr) works!
Where do I find the definition of all unix structures? I can''t find the definition of sockaddr_in anywhere.
Where do I find the definition of all unix structures? I can''t find the definition of sockaddr_in anywhere.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
All of the socket structures are in netinet/in.h
This should do what you want -
This should do what you want -
#include <sys/socket.h>#include <netinet/in.h>int main(void) { struct sockaddr_in address; sizeof(struct sockaddr_in); return 0;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement