Directory Tree

 BBS: Inland Empire Archive
Date: 04-02-92 (10:21)             Number: 127
From: MICHAEL MALLEY               Refer#: NONE
  To: DAVID POSKIE                  Recvd: NO  
Subj: Directory Tree                 Conf: (2) Quik_Bas
DP>I think your generalization isn't valid for many cases. I can always find

Not true.

DP>out where COMMAND.COM is located. I can also find out whether there is
DP>enough space available. I don't have to blindly use a technique like you
DP>propose simply to be safe. Beyond that, none of the systems I program for
DP>have anything hinky about where CONFIG.SYS & AUTOEXEC.BAT reside, and none
DP>of them have any space problems. If I were to write stuff to satisfy the
DP>requirements of some nerd who's operating off a floppy
DP>with a secret locatio
DP>for his configuration files, then I would agree with your recommendation.

Prior to doing a successful SHELL you have to:

1.  Check the COMSPEC to see where the command processor is located.
2.  Find out if the command processor is available.
3.  If it is, SHELL, if it isn't request for it to be made available and
    go to #2

If you are doing a SHELL to get a directory tree, the best way to get
the directory is to use DOS function 4E & 4F.  You've got to use 4E
anyway to see if the command processor is available unless you want to
use some kludge like:
  OPEN Processor$ FOR BINARY AS #1
And to top it off you have to check for space available.  Then your
program is *STILL* liable to stop working when a new DOS comes out.
Take for example the DIRCMD environment variable in 5.0 & changes in the
way that directory listings are presented.  True, you can *now* program
to deactivate the DIRCMD setting, but all of your other programs that
used that route no longer work reliably.  Also it is poor practice to
program while supposing:  noone will ever do *this*, or noone will ever
do *that*.

My technique is *NOT* blind, it is the only sure way to get the
directory information reliably.  If anything using SHELL "DIR > TMP.TXT"
is what is blind.

Lastly, you don't need to know where AUTOEXEC.BAT and CONFIG.SYS are,
even with a SHELL.

DP>Here's a generalization I offer for you to shoot at: only nerds have
DP>systems where you can't easily find COMMAND.COM, and only nerds have
DP>systems where I can't have space for 2k for my program to write a
DP>temp file. Finally, I don't see any future in programming for nerds.

Not true, and if you really think that way, then it is you that is the
nerd.  Case in point.  Many people do not use COMMAND.COM, they may use
some proprietary processor such as 4DOS, and if you are only looking for
COMMAND.COM prior to the SHELL than you won't find it.  Secondly, some
people are still running floppy only systems.  If you make them swap
floppies to run a SHELL, you won't get a correct directory listing.
Also, with all of the virus scares, people will try to isolate a new
program prior to using it widely.  Also, I've run out of room on a hard
disk before, and will probably do so again.

If you are only writing programs for clients that don't care about a
well mannered program OR will always run your program in such a manner
as to always have your assumptions come true, then good for you!
Unfortunatly, most of us write an app, and sell it (hope to sell it) to
many, and if you don't write so that that app will run on EVERY machine,
you are asking for trouble.

I'm not trying to be a {Flame}, I just re-read this and it sounds like
one, but the points *are* valid.  I hope you take this in the way it was
intended.  Type @ U Later!  :)

 * SLMR 2.1a * If at first you don't succeed, you can always emulate me!

--- Maximus 2.01wb
 * Origin: UltraTech - Nashville, TN  (615) 356-0453 {HST} (1:116/30)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET