News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#11
General discussions / Legacy header files
Last post by ander_cc - Yesterday at 06:03:06 AM
There are two header files in folder "Include/win/winsqlite/": winsqlite3.h and winsqlite3ext.h.
But no related .lib files are included in folder "Lib".
Is this a deprecated feature?
#12
Tips & tricks / Re: LiteZip tests
Last post by Vortex - April 29, 2026, 01:31:51 PM
Here is a zip sample :

// Source code by ChatGPT

#include <windows.h>
#include <stdio.h>
#include "LiteZip.h"

void AddFolder(HZIP hz, const char *basePath, const char *relPath)
{
    char search[MAX_PATH];
    WIN32_FIND_DATAA fd;
    HANDLE hFind;

    sprintf(search, "%s\\%s\\*", basePath, relPath);

    hFind = FindFirstFileA(search, &fd);
    if (hFind == INVALID_HANDLE_VALUE)
        return;

    do
    {
        if (strcmp(fd.cFileName, ".") == 0 ||
            strcmp(fd.cFileName, "..") == 0)
            continue;

        char fullPath[MAX_PATH];
        char zipPath[MAX_PATH];

        sprintf(fullPath, "%s\\%s\\%s", basePath, relPath, fd.cFileName);

        if (relPath[0])
            sprintf(zipPath, "%s\\%s", relPath, fd.cFileName);
        else
            sprintf(zipPath, "%s", fd.cFileName);

        if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
            AddFolder(hz, basePath, zipPath);
        }
        else
        {
            printf("Adding: %s\n", zipPath);
            ZipAddFileA(hz, zipPath, fullPath);
        }

    } while (FindNextFileA(hFind, &fd));

    FindClose(hFind);
}

int main(void)
{
    HZIP hz;

    if (ZipCreateFileA(&hz, "archive.zip", 0) != 0)
    {
        printf("Cannot create ZIP\n");
        return 1;
    }

    AddFolder(hz, "C:\\testfolder", "");

    ZipClose(hz);
    printf("Done.\n");
    return 0;
}
#13
General discussions / v 14.10 debugger
Last post by TimoVJL - April 29, 2026, 11:11:39 AM
Have anyone problems with debugger with their code ?
#14
Add-ins / Re: AddIn Create/Open 32-bit p...
Last post by TimoVJL - April 29, 2026, 09:39:26 AM
Fix for UTF-8 BOM
#15
Tips & tricks / Re: LiteZip tests
Last post by Vortex - April 28, 2026, 09:42:07 PM
Hi Timo,

Thanks for the static libraries. With the help of ChatGPT, here is an unzip sample :

// Dependencies required to build the project
// LiteUnzip.h and LiteUnzip.lib from LiteUnzip_WS2.zip
// https://forum.pellesc.de/index.php?msg=42339
// Sample code by ChatGPT

#include <windows.h>
#include <stdio.h>
#include "LiteUnzip.h"

int main(void)
{
    HUNZIP hz;
    ZIPENTRY ze;
    DWORD numitems, i;

    // Open ZIP
    if (UnzipOpenFileA(&hz, "test.zip", 0) != 0)
    {
        printf("Cannot open ZIP file\n");
        return 1;
    }

    // Get number of items
    ze.Index = (DWORD)-1;
    if (UnzipGetItemA(hz, &ze) != 0)
    {
        printf("Cannot get ZIP info\n");
        UnzipClose(hz);
        return 1;
    }

    numitems = ze.Index;
    printf("Files in archive: %lu\n", numitems);

    // Extract loop
    for (i = 0; i < numitems; i++)
    {
        ze.Index = i;

        if (UnzipGetItemA(hz, &ze) != 0)
        {
            printf("Error reading item %lu\n", i);
            continue;
        }

        printf("Extracting: %s\n", ze.Name);

        if (UnzipItemToFileA(hz, ze.Name, &ze) != 0)
        {
            printf("Failed to extract %s\n", ze.Name);
        }
    }

    UnzipClose(hz);
    return 0;
}
#16
Tips & tricks / LiteZip tests
Last post by TimoVJL - April 28, 2026, 08:53:52 PM
LiteZip 2008 version tests with static libraries.

Check this too
https://www.wischik.com/lu/programmer/zip_utils.html
#17
User contributions / Re: Github-kuba miniz for Pell...
Last post by TimoVJL - April 28, 2026, 08:44:20 PM
So it was missing from LiteUnzip package  :(
#18
User contributions / Re: Github-kuba miniz for Pell...
Last post by Vortex - April 28, 2026, 08:40:11 PM
Hi Timo,

Could you provide the file LiteUnzip.h ? I think this one is missing.
#19
User contributions / Re: Github-kuba miniz for Pell...
Last post by TimoVJL - April 28, 2026, 08:38:21 PM
That example use only additional LiteZip.lib and msvcrt.lib
A msvcrt was used to show actual code size.
#20
User contributions / Re: Github-kuba miniz for Pell...
Last post by Vortex - April 28, 2026, 08:29:58 PM
Hi Timo,

The command line zip tool works fine. Do you have the static library version of unzip?