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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -