Free Game Downloads -- Sodaware.net

Free Game Downloads -- Role Playing Games, Puzzle Games and Action Games.

Using zip files with Blitz Basic

How to use zip files within Blitz Basic applications. Open and create archives and compress your data.

Zip files are one of the most common compression formats around, and are a great way of storing files. Using the userlib functionality of BlitzPlus and Blitz3D, it’s now possible to access and manipulate zip files from within your Blitz applications. This can be useful for packing your media, as well as compressing network data.

This article will show you the following:

  • What files you need to use zip files in Blitz, and how to install them.
  • How to open an archive file and find out what files it contains.
  • How to extract a file from an archive.
  • How to create a new zip file and add files to it.
  • How to compress and uncompress Blitz banks.

What will you need?

Blitz.ZipApi — A free library that you can include in your Blitz project. It comes with everything you need to use zip functionality within Blitz.

Installing the files

Once you’ve downloaded the library, you’ll need to copy “zlibwapi.dll” and “zlibwapi.decls” to the appropriate “userlibs” folder so that you can use the userlib functions in your application. This will be something similar to “c:\program files\blitzplus\userlibs\”. The userlib file is fully documented and has XML comments for use with Protean IDE.

You’re now able to use simple zip functions, but if you’d like to get easier access to some of the more common functions, you should include the following into your project:

  • Blitz_File_ZipApi.bb — Helper functions for using zip files in Blitz.
  • Blitz_File_FileName.bb — A few functions for manipulating file names. Use them to get a directory name, file name and extensions from a string.
  • Blitz_Basic_Bank.bb — PeekString and PokeString functions.

All of these files are included in the Blitz.ZipApi distribution, along with full documentation in HTML format.

How it works

The zip library works in a similar fashion to the standard Blitz file functions. Before a file can be read from it should be opened with ZipApi_Open, and once finished with it should be closed with ZipApi_Close. Files to be written to should be opened with ZipApi_CreateZip and closed with ZipApi_CloseZip.

Fully documented examples are included with the library, and are also available online.


Pages: 1 2


These icons link to social bookmarking sites where readers can share and discover new web pages.

Article Info

Date: February 15, 2007

Author: Phil Newton


Categories:

Hot Game Downloads

Fitznik

Fitznik

Join Fitz on his quest for treasure!


Kenny's Adventure Kenny's Adventure
Amazing aquatic adventures with Kenny!
Word Harmony Word Harmony
Reach Word Game Nirvana with this refreshing puzzler!

No comments have been posted yet. Why not be the first?


Leave a comment [TrackBack URI]


Tags Allowed: a, abbr, acronym, b, blockquote, code, em, i, strike, strong

 


Browse By Date

Adventures in Shareware

Welcome to "Adventures in Shareware", the blog of an indie software business known only as "Sodaware". Learn all about indie games, the people that make them and how you can improve your own indie business.

Download Free Computer Games | Site Map | Links | Contact Us

© 2005-2007 Sodaware. All rights reserved. About Us | Privacy Policy