Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
The Modern C++ Challenge

You're reading from   The Modern C++ Challenge Become an expert programmer by solving real-world problems

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781788993869
Length 328 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (20) Chapters Close

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. Math Problems FREE CHAPTER 2. Language Features 3. Strings and Regular Expressions 4. Streams and Filesystems 5. Date and Time 6. Algorithms and Data Structures 7. Concurrency 8. Design Patterns 9. Data Serialization 10. Archives, Images, and Databases 11. Cryptography 12. Networking and Services 1. Bibliography 2. Other Books You May Enjoy Index

Solutions


79. Finding files in a ZIP archive

There are a variety of libraries that provide support for working with ZIP archives. Among the ones available for free, the most used ones include ZipLib, Info-Zip, MiniZip, and LZMA SDK from 7z. And then, there are also commercial implementations. For the problems regarding ZIP archives in this book, I have chosen ZipLib. This is a lightweight, open source cross-platform C++11 library built around standard library streams, with no additional dependencies. The library, along with its documentation, is available at https://bitbucket.org/wbenny/ziplib.

To implement the required functionality, you have to:

  • Open the ZIP archive using ZipFile::Open()
  • Enumerate all the entries in the archive using ZipArchive::GetEntry() and ZipArchive::GetEntryCount()
  • For all entries that represent files, check that the name matches the provided regular expression using ZipArchiveEntry::GetName()
  • For all entries that match the regular expression, add the full name to the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images