pFile = fopen ("C:\\myfile.txt" , "r");
fgets (env , 100 , pFile);
fclose (pFile);
// fetch XXXXXXX
const char * lastSlash = strrchr(env, '//');
if(lastSlash != NULL)
{
const char* lastPeriod = strchr(lastSlash, '.');
if(lastPeriod != NULL)
{
// Better to copy to some other var, for ex. overwriting env
strncpy(env, lastSlash + 1, lastPeriod - lastSlash - 1);
}
}
|