Solved

I want to read data file by CGI

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

627 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