On Tue, 13 Aug 2002 10:16:45 -0500 (Central Daylight Time), Patrick
Mullen <[log in to unmask]> wrote:
>peter,
>
>>
>>The lines of C are like this -
>>
>>if (access("ADIR/ADIR2", 0) <0)
>> printf("File does not exist\n");
>>
>
>it is not clear which directory this is being run from...perhaps it
>is it just a matter of checking the proper directory?
It's relative to the current directory. This allows people to have
several "ADIR"'s on the system. By "proper directory" do you mean a
full path name like "/DEV/DEV/PETERS/ADIR/ADIR2" ? When I log in I am
in "/DEV/DEV" . I created the rest using "mkdir".
Anyway, I tried using the full path and it works! This example is
opening a file rather than using access -
===========
fprintf(stderr, ">>> \n");
system("pwd");
file="/DEV/DEV/PETERS/TGAFORMS/FORMS1/FRED";
if(access(file, 0) < 0)
fprintf(stderr, "%s does not exist\n", file);
else
fprintf(stderr, " %s does exist\n", file);
file="TGAFORMS/FORMS1/FRED";
if(access(file, 0) < 0)
fprintf(stderr, "%s does not exist\n", file);
else
fprintf(stderr, " %s does exist\n", file);
===========
produces -
======================
>>>
/DEV/DEV/PETERS (this is the result of "pwd")
/DEV/DEV/PETERS/TGAFORMS/FORMS1/FRED does exist
TGAFORMS/FORMS1/FRED does not exist
======================
So I'm not sure why relative paths don't work from COBOL but I'll work
around it.
Think I've got a problem with checking directories still but not sure
if that's essential.
Thanks.
Peter
--
http://www.wadmag.org.uk
http://uk.geocities.com/ukwebring - UK Motorcycle site webring
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|