Click here to Skip to main content
14,385,373 members

C / C++ / MFC

 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Dave Kreskowiak17-Oct-18 10:38
mveDave Kreskowiak17-Oct-18 10:38 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Steve Thresher17-Oct-18 11:29
MemberSteve Thresher17-Oct-18 11:29 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Dave Kreskowiak17-Oct-18 11:36
mveDave Kreskowiak17-Oct-18 11:36 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 11:36
mveRichard MacCutchan17-Oct-18 11:36 
GeneralRe: Split paragraph into lines based on width in pixels Pin
leon de boer17-Oct-18 19:39
Memberleon de boer17-Oct-18 19:39 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 22:28
mveRichard MacCutchan17-Oct-18 22:28 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Joe Woodbury18-Oct-18 14:11
professionalJoe Woodbury18-Oct-18 14:11 
Questionchange C code from persistent to none persistent in HTML Pin
Roozbeh Amiressami17-Oct-18 1:51
MemberRoozbeh Amiressami17-Oct-18 1:51 
I wanna change this C code from persistent to none persistent in HTML
please help me i don't know about that

<pre lang="c++"> int main(int argc, char *argv[])
        {
            struct sockaddr_in server_addr, client_addr;
            socklen_t sin_len = sizeof(client_addr);
            int fd_server, fd_client;
            char buf[2048];
            int fdimg;
            //int on = 1;
            
            fd_server = socket(AF_INET, SOCK_STREAM, 0);
            if(fd_server < 0)
            {
                perror("socket");
                exit(1);
            }
            
            //setsockopt(fd_server, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(int));
            
            server_addr.sin_family = AF_INET;
            server_addr.sin_addr.s_addr = INADDR_ANY;
            server_addr.sin_port = htons(8080);
            
            if(bind(fd_server, (struct sockaddr *) &server_addr, sizeof(server_addr)) == -1)
            {
                perror("bind");
                close(fd_server);
                exit(1);
            }
            
            if(listen(fd_server,10) == -1)
            {
                perror("listen");
                close(fd_server);
                exit(1);
            }
            
            while(1)
            {
                fd_client = accept(fd_server, (struct sockaddr *) &client_addr, &sin_len);
                if(fd_client == -1)
                {
                    perror("Connection Failed! Can't Conneect to Client .... \n");
                    continue;
                }
                printf("Accepted the Client Connection ..... \n");
                
                if(!fork())
                {
                    /* Child Process */
                    close(fd_server);
                    memset(buf, 0, 2047);
                    read(fd_client, buf, 2047);
                    
                    printf("%s\n", buf);
                    
                    if(!strncmp(buf, "GET /testicon.ico", 16))
                    {
                        fdimg = open("testicon.ico", O_RDONLY);
                        sendfile(fd_client, fdimg, NULL, 200000);
                        close(fdimg);
                    }
                    else if(!strncmp(buf, "GET /testpic.jpg", 16))
                    {
                        fdimg = open("testpic.jpg", O_RDONLY);
                        sendfile(fd_client, fdimg, NULL, 60000);
                        close(fdimg);
                    }
                    else
                        write(fd_client, webpage, sizeof(webpage)-1);
                    close(fd_client);
                    printf("Closing ... \n");
                    exit(0);
                }
                /* Parent Process */
                close(fd_client);
            }
            return 0;
        }

QuestionRe: change C code from persistent to none persistent in HTML Pin
Richard MacCutchan17-Oct-18 3:24
mveRichard MacCutchan17-Oct-18 3:24 
AnswerRe: change C code from persistent to none persistent in HTML Pin
leon de boer17-Oct-18 4:48
Memberleon de boer17-Oct-18 4:48 
QuestionGeolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 1:13
Memberjung-kreidler17-Oct-18 1:13 
AnswerRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 3:02
MemberVictor Nijegorodov17-Oct-18 3:02 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:04
Memberjung-kreidler17-Oct-18 21:04 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 21:46
MemberVictor Nijegorodov17-Oct-18 21:46 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:49
Memberjung-kreidler17-Oct-18 21:49 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 22:07
MemberVictor Nijegorodov17-Oct-18 22:07 
AnswerRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 22:22
Memberjung-kreidler17-Oct-18 22:22 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov18-Oct-18 0:51
MemberVictor Nijegorodov18-Oct-18 0:51 
QuestionCalculating decimal places - Pin
ptr_Electron16-Oct-18 2:56
Memberptr_Electron16-Oct-18 2:56 
AnswerRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 3:05
mveRichard MacCutchan16-Oct-18 3:05 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:26
Memberptr_Electron16-Oct-18 3:26 
GeneralRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 4:40
mveRichard MacCutchan16-Oct-18 4:40 
SuggestionRe: Calculating decimal places - Pin
David Crow16-Oct-18 3:47
MemberDavid Crow16-Oct-18 3:47 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:52
Memberptr_Electron16-Oct-18 3:52 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 4:03
Memberptr_Electron16-Oct-18 4:03 

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.