Solved

I want to read data file by CGI

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now