Note that there are some explanatory texts on larger screens.

plurals
  1. POplease who can help me to solve this error in under unix
    primarykey
    data
    text
    <pre><code>client.c:60:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat] client.c:63:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat] </code></pre> <p>This is the code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;netinet/in.h&gt; #include &lt;sys/socket.h&gt; #include &lt;arpa/inet.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;unistd.h&gt; int main(int argc , char ** argv) { if(argc != 3) //check for parameters { printf("usage : a.out &lt;IP=127.0.0.1&gt; &lt;Port number=22033&gt;\n"); return 0; } //int x; int sockfd , port = 0 ; int intger[101] , buff[101]; struct sockaddr_in servaddr; port = atoi(argv[2]); //convert port number from string to integer bzero(&amp;servaddr,sizeof(servaddr)); //reset the servaddr servaddr.sin_family = AF_INET; servaddr.sin_port = htons(port); inet_pton(AF_INET, argv[1], &amp;servaddr.sin_addr); sockfd = socket(AF_INET, SOCK_STREAM, 0); //new socket bzero(buff,101); //reset the buffer bzero(intger,101); // connect(sockfd, (struct sockaddr *) &amp;servaddr, sizeof(servaddr)); //connect to the server bzero(buff,101); //reset the buffer //for(;;){ printf("Please Enter an Integer :"); scanf("%d", intger); //reading from the user write(sockfd , intger , 300); //sending the integer to the server printf("Sending %d to the server\n" , intger); printf("Waiting for server reply ...\n"); read(sockfd , buff , 300); printf("Received %d from the server\n" , buff); //bzero(buff,300); printf("\n"); //} return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload