Article View: comp.os.os2.programmer
Article #1459Re: Need C segment to get directory on OS2
From: Peter Knight
Date: Tue, 21 Aug 1990 12:31
Date: Tue, 21 Aug 1990 12:31
41 lines
1948 bytes
1948 bytes
gould@pilot.njin.net (Brian Jay Gould) writes:
>I know this is lazy, but I have no intention of becoming an OS/2 programmer.
>Could someone please suggest a code segment that returns the first filename
>in a directory? I'd like to get as the return, the oldest file in the
>directory. No HPFS in this case.
>My eternal thanks to anyone who helps.
>--
>*************************************************
>* Brian Jay Gould - Professional Brain-stormer *
>*************************************************
{
FILEFINDBUF buf;
DosFindFirst ("*.*",HDIR_SYSTEM, FILE_read_docu_for_options,
&buf,sizeof(buf),1,0);
printf ("%s",buf.achName);
}
-- This code should do the trick. Remember to do a #define INCL_DOSFILEMGR
to get the right include files included. The first parameter is the file spec
so you can use , for example "c:\\*.*", etc, here. For the file options,
you have to decide what you want. This system call is capable of reading
hiddens, etc, so you might normally use FILE_NORMAL ie files that "dir"
can find.
Remember, this does not return the oldest file. You cannot get this
information, as if a deleted file is written over, its place may be used
by a new file.
Incidentally, this code is virtually identical to the MS-DOS int 21/4eh
system call.
Peter Knight
BT Research
#inlcude <std.disclaimer>
Technical Details
Message-ID:
<prk.651241897@aries>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucsd!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!ukc!axion!planet!prkReferences:
<Aug.20.20.19.51.1990.19786@pilot.njin.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucsd!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!ukc!axion!planet!prk From: prk@planet.bt.co.uk (Peter Knight) Newsgroups: comp.os.os2.programmer Subject: Re: Need C segment to get directory on OS2 Message-ID: <prk.651241897@aries> Date: 21 Aug 90 12:31:37 GMT References: <Aug.20.20.19.51.1990.19786@pilot.njin.net> Sender: usenet@planet.bt.co.uk (Usenet News Manager) Organization: RT743, BT Research Labs, Martlesham Heath, Ipswich, UK. Lines: 41