Click here to Skip to main content
15,888,069 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwhat is the difference between "static" function and "inline" function? [SOLVED] Pin
yu-jian12-May-13 16:53
yu-jian12-May-13 16:53 
AnswerRe: what is the difference between "static" function and "inline" function? Pin
SoMad12-May-13 18:29
professionalSoMad12-May-13 18:29 
GeneralRe: what is the difference between "static" function and "inline" function? Pin
yu-jian14-May-13 4:13
yu-jian14-May-13 4:13 
AnswerRe: what is the difference between "static" function and "inline" function? Pin
pasztorpisti12-May-13 21:58
pasztorpisti12-May-13 21:58 
QuestionCHtmlEditCtrl - Overriding printer dialog and use with modeless dialogs Pin
Member 822518012-May-13 4:31
Member 822518012-May-13 4:31 
QuestionHow to set up a computer for network programming on UNIX [SOLVED] Pin
noislude11-May-13 13:44
noislude11-May-13 13:44 
AnswerRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan11-May-13 21:24
mveRichard MacCutchan11-May-13 21:24 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 3:43
noislude12-May-13 3:43 
I asked because, for example, when I compile this code:

XML
#include <stdio.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <strings.h>

#define MAXLINE 100

int main(int argc, char* argv[])
{
   int sockfd, n;
   char recvline[MAXLINE + 1]; /* string onde sera' colocado o dado */
   struct sockaddr_in servaddr;

   if(argc != 2)
   {
     fprintf(stderr, "utilizacao: daytime <endereco IP>");
   }
     if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
       fprintf(stderr, "erro no socket");


     bzero(&servaddr, sizeof(servaddr));
     servaddr.sin_family = AF_INET;
     servaddr.sin_port = htons(13); /* tempo do servidor */

     /* inet_pton - convert IPv4 and IPv6 addresses from text to binary form */
     if(inet_pton(AF_INET, argv[1], &servaddr.sin_addr)) < 0)
       fprintf(stderr, "erro inet_pton para %s", argv[1]);

     if(connect(sockfd, (SA*) &servaddr, sizeof(servaddr)) < 0)
       fprintf(stderr, "erro de conexao");

     while((n = read(sockfd, recvline, MAXLINE)) > 0)
     {
        recvline[n] = 0;
        if(fputs(recvline, stdout) == EOF)
          fprintf("erro de saida");
     }
     if(n < 0)
       fprintf("erro de leitura");
}


I get lots of problems. In particular, I don't have the machine directory but I have installed gcc and build-essential:

SQL
In file included from /usr/include/x86_64-linux-gnu/machine/_types.h:34:0,
                 from /usr/include/x86_64-linux-gnu/sys/_types.h:33,
                 from /usr/include/x86_64-linux-gnu/sys/socket.h:37,
                 from /usr/include/netinet/in.h:25,
                 from /usr/include/arpa/inet.h:23,
                 from daytime.c:2:
/usr/include/x86_64-linux-gnu/i386/_types.h:79:3: note: previous definition of ‘__mbstate_t’ was here
In file included from /usr/include/netinet/in.h:25:0,
                 from /usr/include/arpa/inet.h:23,
                 from daytime.c:2:
/usr/include/x86_64-linux-gnu/sys/socket.h:39:28: fatal error: machine/_align.h: Arquivo ou diretório não encontrado
compilação terminada.

GeneralRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan12-May-13 3:58
mveRichard MacCutchan12-May-13 3:58 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 4:09
noislude12-May-13 4:09 
GeneralRe: How to set up a computer for network programming on UNIX Pin
Richard MacCutchan12-May-13 4:15
mveRichard MacCutchan12-May-13 4:15 
GeneralRe: How to set up a computer for network programming on UNIX Pin
dusty_dex12-May-13 5:02
dusty_dex12-May-13 5:02 
GeneralRe: How to set up a computer for network programming on UNIX Pin
noislude12-May-13 8:54
noislude12-May-13 8:54 
QuestionStrange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH11-May-13 10:02
OmarSH11-May-13 10:02 
AnswerRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
dusty_dex11-May-13 10:23
dusty_dex11-May-13 10:23 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH11-May-13 11:06
OmarSH11-May-13 11:06 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
dusty_dex11-May-13 12:51
dusty_dex11-May-13 12:51 
AnswerRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan11-May-13 21:22
mveRichard MacCutchan11-May-13 21:22 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 3:09
OmarSH12-May-13 3:09 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 3:26
mveRichard MacCutchan12-May-13 3:26 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 3:38
OmarSH12-May-13 3:38 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 3:54
mveRichard MacCutchan12-May-13 3:54 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
OmarSH12-May-13 4:11
OmarSH12-May-13 4:11 
GeneralRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
Richard MacCutchan12-May-13 4:17
mveRichard MacCutchan12-May-13 4:17 
QuestionRe: Strange ERROR!!!!!!!!!!!!!????????????? Pin
David Crow13-May-13 4:53
David Crow13-May-13 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.