Originariamente inviato da oregon
codice:
rmdirectory(strcat(getenv("USERPROFILE"), "\\cookies"));
VVoVe:
Oregon, io ti stimo moltissimo, ma questo codice non va assolutamente usato; cito dalla MSDN:
It is not safe to modify the value of the environment variable using the returned pointer.
E comunque vale sempre la regola "mai effettuare append a stringhe che non si sa come sono state allocate". Semmai:
codice:
char buffer[255]; //I percorsi non sono mai più lunghi di 255 caratteri...
if (strlen(getenv("USERPROFILE"))>(sizeof(buffer)-sizeof("\\cookies")-1))
{
    //...ma bisogna sempre prevedere le situazioni più inusitate.
    cout<<"Buffer di dimensioni insufficienti.";
}
else
{
    strcpy(buffer,getenv("USERPROFILE"),255);
    strcat(buffer,"\\cookies");
    rmdirectory(buffer);
}