home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
SNPD9404.ZIP
/
RFIND1ST.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-03
|
2KB
|
81 lines
.I 15 1
#ifndef OS2
.I 38 1
my_dta = (struct DSTRUCT *)malloc(sizeof(struct DSTRUCT));
.D 39 1
.I 81 74
#else
/************************************************************************/
/* */
/* OS/2 Versions follow - poorly tested! */
/* */
/************************************************************************/
#if OS2 < 2
typedef USHORT UWORD
#else
typedef ULONG UWORD
#endif
static HDIR hdir_ptr = DSIR_CREATE;
#if OS2 < 2
static FILEFINDBUF flist;
#else
static FILEFINDBUF3 flist;
#endif
static PSZ fname;
static UWORD count = 1;
struct DSTRUCT *rfind_1st(char *name, unsigned attribute, struct DSTRUCT *dta)
{
struct DSTRUCT *my_dta;
short retval;
if (NULL == dta)
my_dta = (struct DSTRUCT *)malloc(sizeof(struct DSTRUCT));
else my_dta = dta;
fname = (PSZ)name;
#if OS2 < 2
if (DosFindFirst(fname, &hdir_ptr, attribute, &flist, sizeof(flist),
&count, 0L))
#else
if (DosFindFirst(fname, &hdir_ptr, attribute, &flist, sizeof(flist),
&count, FIL_STANDARD))
#endif
{
return NULL;
}
else
{
my_dta->ATTRIBUTE = (BYTE)(flist.attrFile & 0xff);
my_dta->TIME = flist.ftimeCreation;
my_dta->DATE = flist.fdateCreation;
my_dta->FSIZE = flist.cbFile;
strcpy(my_dta->NAME, flist.achName);
return my_dta;
}
}
struct DSTRUCT *rfind_nxt(struct DSTRUCT *dta)
{
struct DSTRUCT *my_dta;
if (DosFindNext(hdir_ptr, &flist, sizeof(flist), & count))
return NULL;
else
{
my_dta->ATTRIBUTE = (BYTE)(flist.attrFile & 0xff);
my_dta->TIME = flist.ftimeCreation;
my_dta->DATE = flist.fdateCreation;
my_dta->FSIZE = flist.cbFile;
strcpy(my_dta->NAME, flist.achName);
return my_dta;
}
}
#endif