Roger Newson ([email protected]) asked about file extensions
in Stata:
> ...
> What is the algorithm used by Stata to decide whether a filename already
> has an extension? And is it the same for all operating systems? I ask
> because my own program --listtex- can fail when given a filename without an
> extension, because it uses both -outfile- and -file-, and I would like to
> fix this bug in a way that doesn't create other bugs in operating
> environments other than Windows 2000 (under which I use Stata 9.1).
> ...
In part of Roger's email which I omitted, he explained that -outfile-
assigns a default extension when none is specified while -file- does not.
Commands in Stata for which there is a default filetype will add
a default extension if necessary. Examples of such commands are
use
save
insheet
outsheet
infile
outfile
graph use
graph save
log
All such commands work with one main filetype and therefore they can
add a default extension when none is specified.
-file-, on the other hand, is a low-level programmer command. There
is no default kind of file which -file- reads and writes, and therefore
it is up to the programmer to specify an extension. One user might
use -file- with .txt files while another user might use -file- with
.dta files.
Stata determines whether or not a file has an extension in the same
way across all operating systems. It starts at the beginning of
the filename and looks forward for a period. If one is found,
then Stata determines the file has an extension and will not add
one.
--Alan
([email protected])
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/