static int read_file_info(unzFile uf) { unz_file_info fi; memset( &fi, 0, sizeof(fi)); g_lv.unz = uf; const unsigned int MAX_COMMENT = 256; char fname[MAX_PATH + 1]; char comment[MAX_COMMENT + 1]; unzGoToFirstFile(uf); do { if (unzGetCurrentFileInfo(uf, &fi, fname, MAX_PATH, NULL, 0, comment, MAX_COMMENT) != UNZ_OK) { return -1; } node* n = new node; std::wstring path = utf8util::UTF16FromUTF8(fname); wchar_t time[32]; ::wsprintf(time, L"%d/%d/%d %d:%d", fi.tmu_date.tm_year, fi.tmu_date.tm_mon, fi.tmu_date.tm_mday, fi.tmu_date.tm_hour, fi.tmu_date.tm_min); n->size = fi.uncompressed_size; n->tm = fi.tmu_date; n->sz = format_thousands_separator(n->size/1024+1); n->sz += L" KB"; n->time = time; n->path = path; add_node(n, path); } while (unzGoToNextFile(uf) == UNZ_OK); add_items(); return 0; }
int main() { printf("num1(%s), num2(%s), num3(%s)\n", format_thousands_separator(0),format_thousands_separator(123456),format_thousands_separator(23456789)); return 0; }