Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Deciding whether to add a filename extension


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: Deciding whether to add a filename extension
Date   Tue, 11 Oct 2005 16:19:39 +0100

A further query. Would I be justified in assuming that, under any operating system existing or forseeable, a -tempfile- name will always have an extension, so we can always -use-, -save-, -insheet-, -outsheet-, -infile-, -outfile-, -graph use-, -graph save- and -log- using tempfiles? (Just to be sure.)

Roger


At 00:07 11/10/2005, Alan Riley wrote:

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/

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index