Re: Adding variables to AssignFile command

[ Delphi Forum ] [ Delphi Tutorials -- by DelphiLand ]

Posted by webmaster Guido on May 21, 2003
In Reply to: Adding variables to AssignFile command posted by RSQJohn on May 20, 2003

: Hi there, I am trying to create a file at runtime with the code

: AssignFile(FOut,'C:\emails\john.txt');

: This works fine, what I need to do is stick a variable in there so that each file I create has a different filename. I tried

: AssignFile(FOut,'C:\emails\'+dateToStr(date)+'.txt');

: but it came up with "Invalid Filename" when I tried to open the file with

: rewrite(FOut);

: Any help would be great :)

DateToStr() gives a string containing the character /
...but / is not allowed in a filename ;-)

[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]