🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #937

Re: Need help reading directory structures?

#937
From: Frank Hoffmann
Date: Mon, 17 Aug 1992 14:33
32 lines
2016 bytes
millard@acsu.buffalo.edu (Peter G. Millard) writes:

>I was wondering what is the easiest way to check for and see
>if input is a directory or file (is this possible via interrups or
>something like them?)

>For example, at a prompt someone can type in either a filename
>or a directory (to search). I need to distinguish between the two.
>(ie. if they type in a filename, load the file...if it's a directory,
>jump to another subroutine to search the path w/ specific file specs and 
>show results in window,etc...)The problem I have is I don't know how
>to ask the drive if the input is a file or a dir..

>Is there an easy way to do this?

Sure !

1. Execute a _dos_findfirst() for that file. (Include all archive bits
   _A_NORMAL|_A_RDONLY|_A_HIDDEN|_A_SYSTEM|_A_SUBDIR|_A_ARCH )

2. Compare (find_t.attrib & A_SUBDIR). True ?? (>0), then it's a subdir!

frank
-------------------------------------------------------------------------------
    __________                  Frank Hoffmann
     /             /    Siemens-Nixdorf Info. Systems Voice: [+49] 5251 812 209
    /__           /      Dept: AP 52 / SW-Production    Fax: [+49] 5251 811 599
   /' _  _   __  //            Fuerstenallee 7          USA: fh.pad@sni-usa.com
__/__/__(_(_/ /_/^\__    W-4790 Paderborn / Germany    !USA: fh.pad@sni.de
-------------------------------------------------------------------------------
( * )  <--- The green dot.  This mail is reusable. Copy to /dev/null instantly.
-------------------------------------------------------------------------------
Technical Details
Message-ID: <frank.714062035@fam168>
Path: arc1-ca.pugleaf.net!sparky!uunet!gossip.pyramid.com!aquila.sni-usa.com!news.sni.de!fam168!frank
References: <Bszpyt.D5H@acsu.buffalo.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!gossip.pyramid.com!aquila.sni-usa.com!news.sni.de!fam168!frank
From: Frank Hoffmann <fh.pad@sni.de>
Subject: Re: Need help reading directory structures?
Message-ID: <frank.714062035@fam168>
Sender: news@nixpbe.sni.de
Organization: Siemens Nixdorf Info.Sys. AG, Paderborn, Germany
References: <Bszpyt.D5H@acsu.buffalo.edu>
Date: Mon, 17 Aug 1992 14:33:55 GMT
Lines: 32