Solved

WinNT and C++ cgi

Posted on 1998-08-31
1
161 Views
Last Modified: 2013-12-25
Hi, can anyone tell me why my cgi script written in C runs perfectly fine in Unix and fails under windows nt?

The cgi prints out an image to the stdio!
0
Comment
Question by:sidefoo
1 Comment
 
LVL 7

Accepted Solution

by:
jconde earned 200 total points
ID: 1828390
Sidefoo, the problems you have is normal!

What happens is that in Unix, the stdio is binary, and in Windows its text.
i.e.  Try the following in Unix and Windows and see what happens:

1)  type picture.gif > picture2.gif (windows)
2)  cat picutre.gif > picture2.gif (Unix)

..see the difference?

to correct that you must convert the std output of windows to binary.

you can accomplish that by simply putting the following line in your code:

setmode (fileio(stdio), O_BINARY);
cout << "Content-type:  image/gif" << endl << endl;

Make sure to check the setmode function out, since I dont have a compiler with me at this time, and I don't remember the exact way to call it.

--jconde
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question