[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Deciding whether to add a filename extension
Roger Newson (firstname.lastname@example.org) asked about file extensions
> 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
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
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
* For searches and help try: