I'm stuck on pset6. I keep getting error 404 and cannot figure out what is wrong. Please help.
// TODO: concatenate root and absolute-path
char *a;
char *b;
if (strchr(line, 63) != NULL)
{
a = strchr(line, 47);
b = strchr(line, 63)-1;
}
else
{
a = strchr(line, 47);
b = strrchr(line, 32)-1;
}
char path[b-a-1+strlen(root)+1];
strcpy(path, root);
strncat(path, a, b-a);
// TODO: ensure path exists
if (access(path, F_OK)!=0)
{
error(404);
continue;
}
root
. Also don't use the ASCII numeric values. You don't have to and it makes your code much more unreadable. – ChrisG Jul 18 '15 at 6:44