Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>filefind</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  FILEFIND

  .  Summary

  filefind(str <filespec>, int <attrib>, str <buffer>);

  .  Description

  The filefind function is used to search for the existence of one or
  more files or disk directories. Filefind puts in <buffer> the name
  of the first file matching <filespec>, which may include a drive and
  path as well as a filename, and may use the DOS wildcard characters
  * and ? (e.g., "*.*", "C:\TELIX\TELIX.EXE", "SCRIPTS\TEST??.*").
  <attrib> is the attribute (also see fileattr) which files must
  match. The attribute is obtained by adding certain values as fol-
  lows:

       0    Normal files and read only files
       2    Hidden files
       4    System files
       8    Disk volume label
       16   Subdirectory

  If the attribute is 0, only normal (and read-only) files are found.
  If the volume label is selected, only volume labels will be re-
  turned. Any other selected attribute or combination (addition) of
  attributes results in those files and all normal files being
  matched.

  When a matching file, directory, or volume name is found, it is put
  in <buffer> (note that the drive and path portion of filespec are
  not copied), and a non-zero (TRUE) value is returned. The size,
  date/time, and attributes of the matched file can be seen with the
  filesize, filetime, and fileattr functions, respectively.  If no
  files matching the file specification are found, a zero (FALSE)
  value is returned.

  If <filespec> is blank (""), then filefind searches for the next
  matching file. Note that this will not work after an intervening
  call to filesize, filetime, or fileattr with a non-blank filename,
  as the same buffer is used for searches and to keep data.

  .  Return Value

  A non-zero (TRUE) value is returned if a file matching the speci-
  fication was found, otherwise a value of zero (FALSE) is returned.

  .  Example

  // show all normal files in the current directory
  str buf[16], fspec[16] = "*.*";
  while (filefind(fspec, 0, buf) != 0)
   {
    prints(buf);    // show file found
    fspec = "";     // so we can continue searching for files
   }

See Also: filesize filetime fileattr

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson