Hello Friends THis is my first Post
i like to program on php/unix, perl
But at this time i have a question.
i want to make an .exe program that make only
1 action or work:
read a JPEG file and send to the browser.
pd:
When i change image/jpeg and file to read to
text/html , html file, the program run and display the html template
Operative System: Windows XP
Web Server: Local Apache win32 server
Using Borland Compiler
--
PROGRAM
i like to program on php/unix, perl
But at this time i have a question.
i want to make an .exe program that make only
1 action or work:
read a JPEG file and send to the browser.
pd:
When i change image/jpeg and file to read to
text/html , html file, the program run and display the html template
Operative System: Windows XP
Web Server: Local Apache win32 server
Using Borland Compiler
--
PROGRAM
Code:
#include <iostream.h> #include <fstream.h> #include <string.h> #include <sys/stat.h> struct stat results; using namespace std; int main () { string s, line; if (stat("d:\\curl\\tmp\\xantatosa.jpg", &results) == 0) { cout <<"Content-Length: "<<results.st_size; } cout << "\n"; cout << "Content-Type: image/jpeg"; cout << "\n\n"; //ifstream myfile ("d:\\panzona\\tmp\\fotogata.jpg", ios:: out | ios::in | ios::binary); fstream myfile("d:\\panzona\\tmp\\fotogata.jpg",ios:: out | ios::in | ios::binary); char ch; myfile.seekg(ios::beg); //go to the beginning of the file while (! myfile.eof() ) { myfile.get(ch); //read one character cout << ch ; //display it } myfile.close(); }
Comment