Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Gets the index of a given file.

Syntax

Code Block
Index = SRP_Zip_FindFile(ZipHandle, File)

Returns

Index of the file if found, or 0 if not found or if there was an error.

Parameters

ZipHandle Handle to an opened zip file. File Name of the file to find.

Remarks

Call this routine to get the index of a known file name. If you already called SRP_Zip_GetFileList, then you do not need to call this method because you can use its return value to determine the index. Instead, use this method when you already know the name of the file you need.

The File parameter must include any subdirectories associated to it. For example, passing "MyImage.BMP" will fail if only "Images\MyImage.BMP" exists in the zip file.

Example

Code Block
// Get the index of a known file
hZip = SRP_Zip_Open("C:\MyFile.zip")
If hZip EQ 0 then
   Call Msg(@Window, SRP_Zip_GetLastError())
end else
   FileIndex = SRP_Zip_FindFile(hZip, "Images\MyImage.BMP")
   If FileIndex NE 0 then
       // use the file index to extract or remove here
   end
   SRP_Zip_Close(hZip)
end