Solved

WinNT and C++ cgi

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Running a powershell task to call exe while logged off 8 63
How to Skip in FOR command if a Directory does not exist. 6 70
React or Angular? 6 54
Where do I learn ES6? 3 51
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now