From: Andreas K. <and...@Ac...> - 2006-01-31 17:53:33
|
> Andreas Kupries wrote: > > Having slept on this I believe the proper name for the > > described functionality is 'clear'. > > > > If the file exists, clear its contents, make it empty. > > And if it doesn't exist, create it as empty. > > > > Hemang's comment about creating the directory leading to the > > file is correct however. I agree that this is something the > > command should do, given my description. This was no problem > > for me so far because it was not used in context where the > > directory would not exist. > > Please provide an example of this that this isn't better > handled with: > set fd [open $filename w] Heh. Just 'grep'd the sources and find that while the command is in the fu.tcl package here, it is not used anywhere :( Hm. It can be seens as 'create an empty' file, or 'truncate an existing' file. In the second case, well, 8.5. will have a 'ftruncate' command. And for the first case it is likely that the file will be filled with data immediately after. So keeping it open makes more sense than closing it and then using 'appendto' etc. to change it. Jeff has an argument here. We apparently do not really need this one. -- Andreas Kupries <and...@Ac...> Developer @ http://www.ActiveState.com, a division of Sophos Tel: +1 604 484 6491 |