Solved

I want to read data file by CGI

Posted on 1997-02-25
2
258 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

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
Changing Audit Policies through scripting 5 67
issue with beginner powershell script. 5 61
Where do I learn ES6? 3 70
Randomize in Owl Carousel v1.3.2 6 45
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…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

803 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