a problem .h file
[ separate thread merged in - metin2 topics not allowed ]
I have a problem using this file. I'm sorry if this is the wrong section,
If anyone knows how to use this file please tell me.
Hope that you know how.
Best Regards
[ separate thread merged in - metin2 topics not allowed ]
I have a problem using this file. I'm sorry if this is the wrong section,
If anyone knows how to use this file please tell me.
Code:
#include "lzo/lzoconf.h"
#include "lzo/lzo1x.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef IN_LEN
#define IN_LEN (128*1024L)
#endif
#define OUT_LEN (IN_LEN + IN_LEN / 16 + 64 + 3)
int main(int argc, char *argv[])
{
if(argc < 3)
{
printf("Usage: %s <extract/pack> <filename>\n", argv[0]);
return 0;
}
char cmd[255];
sprintf(cmd, "%s", argv[1]);
if(strcasecmp(cmd, "extract") == 0) {
printf("extract\n");
return 0;
} else if(strcasecmp(cmd, "pack") == 0) {
char filename[255];
sprintf(filename, "%s", argv[2]);
FILE *fp;
fp = fopen(filename, "r");
printf("pack\n");
lzo_voidp wrkmem;
struct stat st;
stat(filename, &st);
const int fileSize = st.st_size;
wrkmem = (lzo_voidp) xmalloc(LZO1X_1_MEM_COMPRESS);
uint8_t* outputData = (lzo_bytep) xmalloc(OUT_LEN);
*(uint32_t *)outputData = fileSize;
uint32_t compressedSize;
int lzo = lzo1x_999_compress(data, fileSize, outputData + 4, &compressedSize, workingMemory);
return 0;
} else {
printf("CMD: %s \n", cmd);
return 0;
}
}
Hope that you know how.
Best Regards