Maurice Lombardi wrote:
- intfiledemo.pas does not work. Cannot rewrite a non assigned file under djgpp
This should work (works for me in DosEmu). Does GetTempFileName return a valid name?
program Foo;
uses GPC;
begin Writeln (GetTempFileName); Writeln (GetTempDirectory); CheckInOutRes end.
c:\djgpp\tmp\GPaaa13491 c:\djgpp\tmp\
This directory exists. With LFN=y a 10 chars filename should work as expected.
Hope this helps
Just to be sure, does the following program work?
program foo;
var f : Text; s : String (4096);
begin Rewrite (f, 'c:\djgpp\tmp\GPaaa13491'); Writeln (f, 'OK'); Reset (f); Readln (f, s); Writeln (s) end.
If this works, could you please try inserting the following line:
fprintf (stderr, "internal file name: %s\n", filename);
into rts/file.c after the line:
filename = _p_nameit (File, mode);
rebuild the RTS and compile and run the following test program:
program Foo; var f : Text; begin Rewrite (f); end.
It should write `internal file name: (null)' 3 times -- that's ok (for Input, Output and StdErr), and then the temp name which should be a valid, but non-existing file name.
If this still works, you might want to make sure it really isn't a LFN problem. You could change rts/filename.pas, function GetTempFileName, so it return a name not longer than 8+3 (e.g., just return a constant name for testing), and rebuild the RTS. If the problem still exists then, it's no LFN problem...
Frank
Frank Heckenbach a écrit :
Just to be sure, does the following program work?
program foo;
var f : Text; s : String (4096);
begin Rewrite (f, 'c:\djgpp\tmp\GPaaa13491'); Writeln (f, 'OK'); Reset (f); Readln (f, s); Writeln (s) end.
yes
If this works, could you please try inserting the following line:
fprintf (stderr, "internal file name: %s\n", filename);
into rts/file.c after the line:
filename = _p_nameit (File, mode);
rebuild the RTS and compile and run the following test program:
program Foo; var f : Text; begin Rewrite (f); end.
It should write `internal file name: (null)' 3 times -- that's ok (for Input, Output and StdErr), and then the temp name which should be a valid, but non-existing file name.
OK but the error comes afterwards:
internal file name: (null) internal file name: (null) internal file name: (null) internal file name: c:\djgpp\tmp\GPaaa14287 c:/lombardi/djgpp/gpc/bug2.exe: permission denied to erase internal file `F' (er ror #472 at 1597)
This file is indeed created, and it has zero length
If this still works, you might want to make sure it really isn't a LFN problem. You could change rts/filename.pas, function GetTempFileName, so it return a name not longer than 8+3 (e.g., just return a constant name for testing), and rebuild the RTS. If the problem still exists then, it's no LFN problem...
Same result
internal file name: (null) internal file name: (null) internal file name: (null) internal file name: c:\djgpp\tmp\aaa12508 c:/lombardi/djgpp/gpc/bug2.exe: permission denied to erase internal file `F' (er ror #472 at 1597)
Hope this helps
Maurice