Silverfrost Logo About Us | Contact Us
 

FIND_FILE@

Platform

Win32(ClearWin+)

Purpose

To search for a specified file.

Syntax

INTEGER FUNCTION FIND_FILE@ (DIRECTORY, FILENAME, CALLBACK)
CHARACTER*(*) DIRECTORY, FILENAME
EXTERNAL CALLBACK

Description

This function searchs within the given DIRECTORY and its subdirectories for the specified FILENAME, calling the function CALLBACK for each occurrence found. CALLBACK is a function that you provide. It takes no arguments and returns an integer value.

The callback function is called when the search enters a new subdirectory, and when a matching file has been found. clearwin_string@('FIND_FILE_CALLBACK_REASON') is used to distinguish between these cases returning either 'FILE_FOUND' or 'CHECKING_DIRECTORY'.

Subsequently clearwin_string@('FILE_FOUND') returns the file name if a file has been found whilst clearwin_string@('CHECKING_DIRECTORY') returns the full name of a directory if the search enters a new subdirectory.

The callback function should return 1 to stop the search or 0 to continue. If the search is stopped, FIND_FILE@ returns 1 whilst if it completed successfully it returns zero.

The directory and filename strings must not exceed 260 characters.

Follow the link to find some sample code.

 

 

Copyright © 1999-2017 Silverfrost Limited