ZipFile::OpenRead Method (String^)
Opens a zip archive for reading at the specified path.
Assembly: System.IO.Compression.FileSystem (in System.IO.Compression.FileSystem.dll)
Parameters
- archiveFileName
-
Type:
System::String^
The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.
| Exception | Condition |
|---|---|
| ArgumentException | archiveFileName is Empty, contains only white space, or contains at least one invalid character. |
| ArgumentNullException | archiveFileName is null. |
| PathTooLongException | In archiveFileName, the specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must not exceed 248 characters, and file names must not exceed 260 characters. |
| DirectoryNotFoundException | archiveFileName is invalid or does not exist (for example, it is on an unmapped drive). |
| IOException | archiveFileName could not be opened. |
| UnauthorizedAccessException | archiveFileName specifies a directory. -or- The caller does not have the required permission to access the file specified in archiveFileName. |
| FileNotFoundException | The file specified in archiveFileName is not found. |
| NotSupportedException | archiveFileName contains an invalid format. |
| InvalidDataException | archiveFileName could not be interpreted as a zip archive. |
This method is equivalent to calling the Open method and setting the mode parameter to Read. The archive is opened with FileMode::Open as the file mode value. If the archive does not exist, a FileNotFoundException exception is thrown.
Available since 10
.NET Framework
Available since 4.5