Click here to Skip to main content
15,881,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Dave Kreskowiak17-Oct-18 9:38
mveDave Kreskowiak17-Oct-18 9:38 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Steve Thresher17-Oct-18 10:29
Steve Thresher17-Oct-18 10:29 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Dave Kreskowiak17-Oct-18 10:36
mveDave Kreskowiak17-Oct-18 10:36 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 10:36
mveRichard MacCutchan17-Oct-18 10:36 
GeneralRe: Split paragraph into lines based on width in pixels Pin
leon de boer17-Oct-18 18:39
leon de boer17-Oct-18 18:39 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 21:28
mveRichard MacCutchan17-Oct-18 21:28 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Joe Woodbury18-Oct-18 13:11
professionalJoe Woodbury18-Oct-18 13:11 
Questionchange C code from persistent to none persistent in HTML Pin
Roozbeh Amiressami17-Oct-18 0:51
Roozbeh Amiressami17-Oct-18 0: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 2:24
mveRichard MacCutchan17-Oct-18 2:24 
AnswerRe: change C code from persistent to none persistent in HTML Pin
leon de boer17-Oct-18 3:48
leon de boer17-Oct-18 3:48 
QuestionGeolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 0:13
jung-kreidler17-Oct-18 0:13 
AnswerRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 2:02
Victor Nijegorodov17-Oct-18 2:02 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 20:04
jung-kreidler17-Oct-18 20:04 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 20:46
Victor Nijegorodov17-Oct-18 20:46 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 20:49
jung-kreidler17-Oct-18 20:49 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 21:07
Victor Nijegorodov17-Oct-18 21:07 
AnswerRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:22
jung-kreidler17-Oct-18 21:22 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 23:51
Victor Nijegorodov17-Oct-18 23:51 
QuestionCalculating decimal places - Pin
ptr_Electron16-Oct-18 1:56
ptr_Electron16-Oct-18 1:56 
AnswerRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 2:05
mveRichard MacCutchan16-Oct-18 2:05 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 2:26
ptr_Electron16-Oct-18 2:26 
GeneralRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 3:40
mveRichard MacCutchan16-Oct-18 3:40 
SuggestionRe: Calculating decimal places - Pin
David Crow16-Oct-18 2:47
David Crow16-Oct-18 2:47 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 2:52
ptr_Electron16-Oct-18 2:52 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:03
ptr_Electron16-Oct-18 3: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.