Solved

WinNT and C++ cgi

Posted on 1998-08-31
1
159 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

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
User profile Size Report 3 83
copy-item script help 15 78
Python variable _ manually assigned 9 90
exchange ,script 10 51
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

790 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