ok if there is any way to open a file from zip archive without extracting it ?
Printable View
ok if there is any way to open a file from zip archive without extracting it ?
Hm... I don't think so.
Why wouldn't you want to extract it?
That depends on exactly what you mean. You obviously have to extract the data from the archive to use it, but you don't necessarily have to save the extracted data as a file. That depends on how you want to use it. If you want to open it in an external application then you most likely will have to save it, because that application will need to read the data itself. If you want to, for instance, show the contents of an extracted text file in a TextBox in your own app then you won't need to save, because you've already got the file contents.
ok just tell me how windows read it without extracting any file
Windows does extract it, you just don't see it.
Windows itself and lots of other applications will create files in your Temp directory in situations like this. You can do the same. Extract the data from the archive and then just use it as is if you don't need a file but, if you do need a file create one in the Temp directory and then delete it again afterwards. The .NET Framework even provides a specific mechanism for doing so. The IO.Path.GetTempFileName method will create an empty file in the Temp folder with a random name and return that name to you. You can then save your data to that file and then delete it again afterwards. There's no indication in the file name or location of what the file contains, so it's relatively anonymous. THAT is how Windows does it, that's how lots of applications do it and that's how you should do it too.