🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.os2.programmer
2 messages
2 total messages Started by Brian Jay Gould Tue, 21 Aug 1990 00:19
Need C segment to get directory on OS2
#1458
Author: Brian Jay Gould
Date: Tue, 21 Aug 1990 00:19
11 lines
835 bytes
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 *
*************************************************
Re: Need C segment to get directory on OS2
#1459
Author: Peter Knight
Date: Tue, 21 Aug 1990 12:31
41 lines
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>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads