< index < 11. Compression toolkit < 11.5 Getting data from the buffer | ===================================== 11.6 Destroying a compression buffer ===================================== |

Once you don't need the buffer anymore, you can release resources. Note that the adresses returned by the getString function are no longer valid once the buffer has been destroyed.

    C++ : TCODZip::~TCODZip()
    C   : void TCOD_zip_delete(TCOD_zip_t zip)

Parameter | Description
--- | ---
zip | In the C version, the buffer handler, returned by the constructor.

Example :

    C++ : TCODZip *zip = new TCODZip();
          zip->loadFromFile("myCompressedFile.gz");
          char c=zip->getChar();
          int i=zip->getInt();
          float f= zip->getFloat();
          const char *s=strdup(zip->getString()); // we duplicate the string to be able to use it after the buffer deletion
          zip->getData(nbBytes, dataPtr);
          delete zip;
    C   : TCOD_zip_t zip=TCOD_zip_new();
          TCOD_zip_load_from_file(zip,"myCompressedFile.gz");
          char c=TCOD_zip_get_char(zip);
          int i=TCOD_zip_get_int(zip);
          float f=TCOD_zip_get_float(zip);
          const char *s=strdup(TCOD_zip_get_string(zip));
          TCOD_zip_get_data(zip,nbBytes, dataPtr);
          TCOD_zip_delete(zip);