c++ - Encode URLs into safe filename string -


i'm writing simple c++ class in cache picture thumbnails versions of images downloaded web. such, use hash function takes in url strings , outputs unique string suitable filename.

is there simple way without re-writing function myself? searched around simple library, couldn't find anything. surely common problem.

a simpler approach replace not character or number underscore.

edit: here's naive implementation in c:

#include <cctype>  char *safe_url(const char *str) {     char *safe = strdup(str);     (int = 0; < strlen(str); i++) {         if (isalpha(str[i]))             safe[i] = str[i];         else             safe[i] = '_';     } } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -