[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

unstoppable cgi

Posted on 1998-06-21
9
Medium Priority
?
307 Views
Last Modified: 2013-12-25
os: win95
server: netscape fasttrack 2.0

question: i m a beginner to cgi scripting, i've been reading tutorials n introductions during these few weeks on the net, n i've tried writing scripts by myself using batch files, pascal n c. they all works fine, but they just won't stop!

for eg, (a batch file):
  @echo off
  echo Content-type: text/html
  echo.
  echo.
  type a.txt
  exit
n in the a.txt file:
  <HTML><BODY>
  blahblahblah..
  </BODY></HTML>

i thought i could get a line of blahblahblah.. on my browser when i call this bat, but the result is that i can just get a blank screen with my browser telling me xxxbytes read, n the browser just keep waiting n waiting until i press ESC, which is the time i can finally c "blahblahblah..".

i have downloaded some free exe scripts on the net, n they all work very fine on my server. the only difference i notice is that when i tried to double click on these exe files, it pops up a dos window n when it's finished, it close the dos window. when i double click on the exe files i made (by pascal/c), they pops up a dos window, but couldn't close the dos window after finished. it also happens when i compile the free cgi source codes using pas/c. adding return(0) at the end of the program wouldn't help also.


what's wrong actually? is that i have to put something at the end of the source code? or is that i have to use some special compiler? (i m using borland pascal 7.0, turbo c 3.0) or is that something related to my server? (i've added exe n bat as a cgi type in the mime file) or is that win95's own problem?
0
Comment
Question by:rabili
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:rabili
ID: 1829904
Edited text of question
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829905
Your example closes fine on my pc... Perhaps you have a problem

It seems you need to flush the server cache...

At least make sure your program is outputting
Content-type: text/html\n\n      <<<<< Notice TWO newlines

I would also put a newline after the </HTML>

Michel
0
 

Author Comment

by:rabili
ID: 1829906
this is the c program i made:

#include <stdio.h>
int main()
{
       printf("Content-type: text/html\n\n");
       printf("<HTML><BODY>\n");
       printf("<HR><BR>\n");
       printf("blahblah..");
       printf("<HR><BR>\n");
       printf("blahblah..");
       printf("</HTML></BODY>\n");
       return(0);
}

anything wrong?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829907
Looks fine to me...

Not knowing C I would still expect a stdout somewhere and I would perhaps do a fflush(stdout) as well?

Michel
0
 
LVL 1

Expert Comment

by:rcashon
ID: 1829908
rabili, I have been having a similiar problem with my system. Are you running a personal web server on your box? Also, when the CGI executes does it function correctly, but continue to run as though it was searching for exe to run till it times out?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829909
Could it be a 16 bit problem?

I gor this at DejaNews:

Seems to be a 16-bit vs. 32-bit problem.  I recompiled the same code
under VC++ 4.0 as a 32-bit console app and it worked just fine.  MS
wants it to be a 32-bit world...
0
 

Author Comment

by:rabili
ID: 1829910
i've tried this on both pws n netscape fasttrack, n the results r exactly the same.

so if it's really a 16 bit problem, do i need a 32bit c-compiler for making cgi?
0
 
LVL 1

Expert Comment

by:rcashon
ID: 1829911
rabili, It is definatly a 32 bit problem. Mplungjan gave me the comment in the javascript section also. I recompiled using Visual C++ 4.0 and my cgi terminated after it executed correctly. So he was correct with it needing to be compiled as a 32 bit application rather than a 16 bit app. And yes , you will need a 32 bit compiler if you are going to be writing your cgi's in C. I'm new to the CGI in web development and this one problem has been a pain in my rear for a 2 months. Now I can get back to some coding. Mplungjan will probally post that as an answer as I responded over in the Javascript section. Good luck!
Randall
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 300 total points
ID: 1829912
Two birds in one stone

From Dejanews:

Seems to be a 16-bit vs. 32-bit problem.  Recompile the same code
(under VC++ 4.0) as a 32-bit console app and it should work just fine.  MS
wants it to be a 32-bit world...

Michel
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

650 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