Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!haven!umd5!astro.UMD.EDU!jjk
From: jjk@astro.UMD.EDU (Jim Klavetter)
Newsgroups: comp.lang.c
Subject: strcat/access question
Summary: strcat/access question
Message-ID: <5409@umd5.umd.edu>
Date: 2 Oct 89 21:59:36 GMT
Sender: news@umd5.umd.edu
Reply-To: jjk@astro.UMD.EDU
Organization: U. of Maryland @ College Park Astronomy
Lines: 25

Here is a section of code:

if((home=getenv("HOME"))==(char *) 0)
    perror("GETENV\n");
printf("%s:\n", home);
printf("%s:\n", strcpy(string,strcat(home, "/astro/data/obs.list")));
printf("%s:\n", string);
printf("%d:\n", access(string, 4));
printf("%d:\n", access(strcat(home, "/astro/data/obs.list"), 4));

And the associated output:

/a/jjk:
/a/jjk/astro/data/obs.list:
/a/jjk/astro/data/obs.list:
0:
-1:

The man page says that strcat returns a null-terminated string so that
the two calls to access (I think) should both give "0" but the second
is saying the file doesn't exist.  I've included the appropriate
files.  Any response to the above address would be appreciated (and
I will summarize the response if there is some good answer(s)).

jjk