HELP!Delphi/Enterprise/NT/WINCGI

Hi.  I've been totally baffled by this problem for hours.  I'm running
Windows NT V4 with Netscape Enterprise V2.01.  I am using the POST method
to test a simple one entry form.  Basically what happens is Delphi treats
the *.dat file that is created in my C:\temp\x\ directory as an INI file
when reading and accurately determines the directory and name of the *.
out file.  I know the dir and name of the *.out file is accurate because
I output'd it to a text file called debug.txt in my cgi-win directory.  
Now, here comes the kicker.  When I try to rewrite() the *.OUT file (open
it for output), the program aborts.  At first I thought this was a
permission problem.  I output'd my little debug.txt into the C:\temp
directory successfully with the wincgi so I know permissions aren't the
problem.  

Next I rewrote the WINCGI so that instead of using the INIFILES module
inside of Delphi I opened the DAT file as a text file and tried to get
the location of the OUT file.  If I do this in on my home computer with a
copy of a DAT file on it, I can specify it's location on the command line
just like the WINCGI does and it works fine and even makes a proper *.OUT
file.  However,  when this EXE is on the server, it refuses to even read
the *.DAT file.

IT APPEARS THAT I CAN'T USE ANY TEXTFILE OPERATIONS TO MANIPULATE THE *.
DAT and *.OUT FILES.  

Is this a compiler problem, an Enterprise server problem or an NT V4.0
problem??

ANY HELP WILL BE _GREATLY_ APPRECIATED.  
Please direct correspondence to my e-mail address below.

Down below is the source code for the the file that tries to read and
write the OUT and DAT files as text files.  When run on the server, this
file won't even process the DAT file properly but in DOS it works
perfectly!?

Thanks very much for your help,
Bob Marietta
marie...@sluvca.slu.edu

program test;

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs;

var z: byte;
    OutPutFile, instuff, Postedvalues: string;
    debug, infile, outf: textfile;
    done: boolean;

begin{program here}
assignfile(infile,'C:'+ParamStr(1));
reset(infile);
done:=false;
while not eof(infile) and not done do
begin
  readln(infile, instuff);
  if instuff='[System]' then done:=true;
end;
readln(infile);{gmt offset}
readln(infile);{debug}
readln(infile, outputfile);
close(infile);

reset(infile);
done:=false;
while not eof(infile) and not done do
begin
  readln(infile, instuff);
  if instuff='[Form Literal]' then done:=true;
end;
readln(infile, postedvalues);
close(infile);

assign(debug,'debug.txt');
rewrite(debug);
writeln(debug, ParamStr(1));
writeln(debug, outputfile);
delete(outputfile,1,12);
writeln(debug, outputfile);
writeln(debug, postedvalues);
close(debug);

AssignFile(outf,'C:'+OutPutFile);
rewrite(outf);
Writeln(outf,'HTTP/1.0 200 OK' );
Writeln(outf,'DATE:  + webDate( now ) ');
Writeln(outf,'Content-type: text/html' );
Writeln(outf,'' );   {*******required blank line *****}
Writeln(outf, '<HTML><HEAD>' );
Writeln(outf, '<TITLE>Dynamic HTML Page</TITLE>' );
Writeln(outf, '</HEAD><BODY><HR>' );
Writeln(outf,'Your email address is ' +Postedvalues+'<P>');
Writeln(outf, 'Holy Smokes, it worked!<BR>' );
Writeln(outf, '</BODY></HTML>' );
Close(outf);
end.