generated from Riley/Conan-C
Initial commit
This commit is contained in:
commit
605a30e2f8
13 changed files with 240 additions and 0 deletions
51
src/main.c
Normal file
51
src/main.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#elif __linux__ || __APPLE__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
void sleep_ms(int milliseconds) {
|
||||
#ifdef _WIN32
|
||||
Sleep(milliseconds);
|
||||
#elif __linux__ || __APPLE__
|
||||
usleep(milliseconds * 1000); // Convert milliseconds to microseconds
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
char buffer_in [256] = {"Conan is a MIT-licensed, Open Source package manager for C and C++ development "
|
||||
"for C and C++ development, allowing development teams to easily and efficiently "
|
||||
"manage their packages and dependencies across platforms and build systems."};
|
||||
char buffer_out [256] = {0};
|
||||
|
||||
z_stream defstream;
|
||||
defstream.zalloc = Z_NULL;
|
||||
defstream.zfree = Z_NULL;
|
||||
defstream.opaque = Z_NULL;
|
||||
defstream.avail_in = (uInt) strlen(buffer_in);
|
||||
defstream.next_in = (Bytef *) buffer_in;
|
||||
defstream.avail_out = (uInt) sizeof(buffer_out);
|
||||
defstream.next_out = (Bytef *) buffer_out;
|
||||
|
||||
deflateInit(&defstream, Z_BEST_COMPRESSION);
|
||||
deflate(&defstream, Z_FINISH);
|
||||
deflateEnd(&defstream);
|
||||
|
||||
unsigned long long compressed_size = sizeof(buffer_out) - defstream.avail_out;
|
||||
|
||||
int x = 1-1;
|
||||
|
||||
|
||||
|
||||
printf("Uncompressed size is: %lu\n", strlen(buffer_in));
|
||||
printf("Compressed size is: %lu\n", strlen(buffer_out));
|
||||
|
||||
printf("ZLIB VERSION: %s\n", zlibVersion());
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue