void createSearch()
{
    char* cachesize = "0KB";
        
    /* Create a tokenizer */
    tok = TKCreate(FILE_CHARS, "myindex.txt");
    if(tok == NULL)
    {
        fprintf(stderr, "Error: Could not allocate space for Tokenizer.\n");
        return;
    }
    
    /* Get the file list */
    files = getFilelist(tok);
    if(files == NULL)
    {
        return;
    }
    
    /* Create a cache */
    cache = createCache(cachesize);
    if(cache == NULL)
    {
        fprintf(stderr, "Error: Could not allocate space for Cache.\n");
        return;
    }
    
    /* Update the allowed characters */
    adjustAllowedChars(tok, STRING_CHARS);
}
Esempio n. 2
0
ImageList::ImageList(const std::string & image_dir) : image_dir(image_dir)
{
	std::srand(std::time(0));

	auto img_files = getFilelist(image_dir + "\\*.jpg");

	for (auto & file_name : img_files) {
		images.emplace_back(file_name, ImageGray(image_dir + "\\" + file_name));
	}
}