Platform |
Win32, x64 |
Purpose |
To search for a specified file. |
Syntax |
INTEGER FUNCTION FIND_FILE@ (DIRECTORY, FILENAME, CALLBACK) |
Description |
This function searches 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. |