Solved

unstoppable cgi

Posted on 1998-06-21
9
301 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 100 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
copy-item script help 15 85
Animated .jpg? 13 104
Create animated movies for web page 18 120
Remote Exchange powershell returns different results 13 47
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

749 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