Bfile FindNext

From WikiPrizm
Jump to: navigation, search


Synopsis

Header: fxcg/file.h
Syscall index: 0x1DB9
Function signature: int Bfile_FindNext(int FindHandle, const unsigned short* foundfile, file_type_t* fileinfo);

This function is used to list files and folders based on a find handle created by Bfile_FindFirst.

Parameters

  • int FindHandle - The find handle created by Bfile_FindFirst.
  • const unsigned short* foundfile - The string used to store the found file or folder name.
  • file_type_t fileinfo - Pointer to a file_type_t struct. See Bfile_FindFirst for the struct definition.

Returns

  • 0 - Successful read. Data is stored to foundfile and fileinfo
  • -16 - There are no more files or folders to be read. When this happens, call Bfile_FindClose on the FindHandle.

Comments

Using Bfile functions while user timers are installed can cause SYSTEM ERRORs and other undefined behavior, especially with functions that change data on the file system. Make sure to stop and uninstall all timers before using Bfile functions (and optionally restore them later). See Incompatibility between Bfile Syscalls and Timers for more information.

Example

To read files, create a handle with Bfile_FindFirst. If the return value is 0, then the foundfile and fileinfo values are set. Keep calling this function, checking the return, then printing if 0 to read all files in the find handle. See the Using the File System tutorial for a full example