JPEG到浏览器 [英] JPEG to Browser
问题描述
Hello Friends这是我的第一篇帖子
i喜欢在php / unix上编程,perl
但是此时我有一个问题。 />
i希望制作一个只能实现
1动作或工作的.exe程序:
读取一个JPEG文件发送到浏览器。
pd:
当我更改image / jpeg和文件以阅读
text / html时, html文件,程序运行并显示html模板
操作系统:Windows XP
使用Borland编译器
-
程序
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喜欢在php / unix上编程,perl
但是在这个时候我有一个问题。
i希望制作一个只有
的.exe程序1动作或工作:
读取JPEG文件并发送到浏览器。
pd:
我改变image / jpeg和文件来读取
text / html,html文件,程序运行并显示html模板
操作系统:Windows XP
Web服务器:本地Apache win32服务器
使用Borland编译器
-
计划
#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:\\\\\\\\\\\\\\ | ios :: in | ios :: binary);
fstream myfile(" d:\\\\ spanzona \\tmp\\fotogata.jpg",ios :: out | ios :: in | ios :: binary);
char ch;
myfile.seekg(ios :: beg); //转到文件的开头
while(!myfile.eof())
{
myfile.get (CH); //读一个字符
cout<< ch; //显示它
}
myfile.close();
}
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
#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();
}
您的问题是什么?
What is your question?
我的问题是
"将jpeg文件呈现给浏览器的正确C ++ / C代码是什么? ;
:(用我的程序,只在浏览器上显示cant show image
谢谢
My question is
"what is the correct C++ / C Code to present the jpeg file to browser"
:( with my program , only display "cant show image" on the browser
Thanks
我的问题是
"将jpeg文件呈现给浏览器的正确C ++ / C代码是什么?
:(用我的程序,只在浏览器上显示cant show image
谢谢
My question is
"what is the correct C++ / C Code to present the jpeg file to browser"
:( with my program , only display "cant show image" on the browser
Thanks
您的程序是否给您任何错误?运行时会发生什么?
Is your program giving you any errors? What happens when you run it?
这篇关于JPEG到浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!