|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Automatic what is the meaning of aggregate initializati I wrote a socket procedures following is a part :
# Include "ctype.h>
# Include "sys/types.h>
# Include "sys/socket.h>
# Include "netinet/in.h>
# SIZE sizeof (struct sockaddr_in)
Main ()
{
Int sockfd;
Int newsockfd;
Char c;
Struct sockaddr_in server ={AF_INET,7000, INADDR_ANY,0};
If ((sockfd=socket (AF_INET, SOCK_STREAM,0)) ==-1)
If (bind (sockfd, (struct sockaddr_in *) &server, SIZE) ==-1)
{
Perror ( "bind cal failed");
Exit (1);
}
If (listen and (sockfd,5) ==-1)
{
Perror ( "listen and call failed");
Exit (1);
}
For (are;)
{
If ((newsockfd = accept (sockfd, NULL, NULL)) ====== 1)
{
Perror ( "accept call failed");
Continue;
}
But the translation, there are incorrect report :
# Cc server.c -o server
(Bundled) cc : "server.c", line 11 : 1716 : Automatic error initializati aggregate.
(Bundled) cc : "server.c", line 26 : error 1588 : "NULL" undefined. |
">struct Sockaddr_in server ={AF_INET,7000, INADDR_ANY,0};
Brother, valuation, where you came from?
"" "NULL" undefined.
Add #include "stdio.h>
Please code with code labeling. |
-->
This grammar is correct.
But do not advocate that because it means that you need to understand the structure and priorities of each member. |
-->
Attention should also be paid? Network byte order. : D |
| |