Show image

Michael Borisov <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <1218436850.30946.1.camel@niro-laptop>
Hi All!
I try to show some image(png,jpg,gif) with fastcgi?

Simple CGI example works fine:

#include <fstream>
#include <stdio.h>
using namespace std;
int main(){    
   printf("Content-type: image/gif\r\n");
   printf("\r\n");
   ifstream in("../image.gif");
   if (!in) return 1;
   char buf;
   buf = in.get();
   while (in){
      printf("%c",buf);
      buf = in.get();
   }
   in.close();
   return 0;
}

FCGI example don't works:

#include <fstream>
#include "fcgi_stdio.h"
using namespace std;
int main(){
    while(FCGI_Accept() >= 0) {
        printf("Content-type: image/gif\r\n");
        printf("\r\n");
        ifstream in("../image.gif");
        if (!in) return 1;
        char buf;
        buf = in.get();
        while (in){
             printf("%c",buf);
             buf = in.get();
        } 
        in.close();
    }
    return 0;
}

What wrong with that code ? 
apache2                  2.2.3-4+etch4
libapache2-mod-fastcgi   2.4.2-8 
libfcgi0c2               2.4.0-6


_______________________________________________
FastCGI-developers mailing list
[email protected]
http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.