Solved

I want to read data file by CGI

Posted on 1997-02-25
2
259 Views
Last Modified: 2013-12-25
Dear All,

      I'm testing WebSite1.1e and I write CGI by Visual C++ 4.0.  My CGI want to read data file by command

      // test1.cpp
      fstream file("datafile.db");
      // I mean datafile store in current directory
      :

      And I store execute file (test1.exe) in C:\WebSite\cgi-dos But when CGI run on WebSite  it will run at C:\WebSite\cgi-temp.  This program will read datafile from C:\WebSite\cgi-temp not read from C:\WebSite\cgi-dos

      And now!. I write my CGI same as this

      // test2.cpp
      fstream file("c:\\WebSite\\cgi-bin\\datafile.db");
      // I specification directory for datafile
      :

      If I want to write program same as TEST1 How to config WebSite server? or How about CGI program with C++?

Thank so much,
________________/k/u/n/a/w/u/t/__/s/o/u/b/s/e/n/_
b36kws@beethoven.cpe.ku.ac.th.
http://beethoven.cpe.ku.ac.th.
0
Comment
Question by:b36kws
2 Comments
 

Accepted Solution

by:
nunamakt earned 70 total points
ID: 1827791
I've done C, but not with the web. I've been using PERL, but the file I/O is about the same..  Your problem looks more like a mapping problem in WebSite.  I'm using WebSite Pro and looking at the Control | Properties | General Tab, you'll see a text box labeled "CGI Temp Dir."  Mine is currently pointing to c:\WebSite\cgi-temp....the same as yours!

I wrote a simple PERL script to manipulate a small quiz datafile:

if ( open (POLL, "<uac.dat") ) {flock (POLL, $exclusive_lock);

If you don't put the full path on the file, it SHOULD default to the same dir as your CGI program is executing from...  Just don't try to force it with a full DOS path when its looking at it from a web server POV.  You don't put a graphic filename with the
full DOS path so don't do it with your CGI progs..

Try only using the filename...    

Hope this does the trick!
0
 

Author Comment

by:b36kws
ID: 1827792
I don't want to change CGI-TEMP path to CGI program
becase if I have cgi in many directory I can't to do same as this.
  I ever seen we can get Physical Path but I don't know what Variable
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

808 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