![]() |
|
#1
|
|||
|
|||
c++/cgi program can't open file in user dirI'm trying to open/create a file in a user dir with some c++/cgi code but am
getting an error saying it can't. I pass a filename to the following functions but the file does not get created/open. When I get to the " if (!html_file)" 'if' statement (see code snippet below) it doesn't find the file I have a feeling it has to do with permissions again, but everything seems set correctly. Any ideas? (If any moer info is needed please let me know). DETAILS: Code snippet: *** HTMLstream::HTMLstream (const string & filename) { open (filename); } void HTMLstream: { ifstream html_file (filename.c_str()); if (!html_file) { throw invalid_argument ("Could not open data file: " + filename); } string line = ""; while (getline (html_file, line)) { html_code += line; html_code += '\n'; } } . . . *** The cgi user directory is "/home/group3/public_html/cgi-bin" and the programs and directory all have grp/owner 'group3' and 755 permissions. 'httpd.conf' file specifics: *** UserDir public_html . . <Directory "/home/*/public_html/cgi-bin"> AllowOverride All Options Includes ExecCGI Order allow,deny Allow from all </Directory> <Directory "/home/group3/public_html/cgi-bin"> AllowOverride All Options +ExecCGI </Directory> <Directory "/home/*/public_html"> AllowOverride All Order allow,deny Allow from all </Directory> . . AddHandler cgi-script .cgi *** |
|
#2
|
||||
|
||||
|
if you set the permission (chmod) at 777, does it work?
if that works there is a persmision problem with the group. if it does not work with the root user your script has a problem.. I'm not an C++ expert, sorry |
|
#3
|
|||
|
|||
|
Quote:
Actually, turns out I was trying to open an existing file which was missing NOT trying to create one. I copied it to the correct dir, now all works well. |
Recent GIDBlog
Developing GUIs with wxPython (Part 4) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to open file in c++ | mohammed | C++ Forum | 4 | 02-May-2006 17:10 |
| Mozilla Thunderbird | dsmith | Computer Software Forum - Linux | 9 | 01-Mar-2005 11:56 |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 10:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 11:28 |
| [Tutorial] Standard I/O | aaroncohn | C Programming Language | 20 | 27-Feb-2004 21:07 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The