Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

I want to read data file by CGI

Posted on 1997-02-25
2
Medium Priority
?
284 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
[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
2 Comments
 

Accepted Solution

by:
nunamakt earned 140 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

Industry Leaders: 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!

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
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…

688 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