🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #4293

Re: Programming Question

#4293
From: Randell Jesup
Date: Tue, 10 Jul 1990 01:50
18 lines
1382 bytes
In article <8180@ur-cc.UUCP> gest_ltd@uhura.cc.rochester.edu (Gavin Stark) writes:
>
>Question:  Does anyone know how from within C to find the directory that a
>program was run from.. I don't mean the currect shell directory.. I want
>to find the directory where the program actually exists on the disk... Like
>if I had a file in my C directory I would want the program to get DH0:C
>even if I was in DH0:Source when I ran the program.. Any help would be 
>appreciated.

	It's easy under 2.0:  GetProgramDir() returns a lock on the directory,
or references things via PROGDIR:.  Under 1.3, it's harder.  You have to try
to second-guess the shell (search the path, etc), and that doesn't help if
the command-line specified a directory.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"
Technical Details
Message-ID: <13119@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rutgers!cbmvax!jesup
References: <8180@ur-cc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!rutgers!cbmvax!jesup
From: jesup@cbmvax.commodore.com (Randell Jesup)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Programming Question
Keywords: C, programming
Message-ID: <13119@cbmvax.commodore.com>
Date: 10 Jul 90 01:50:13 GMT
References: <8180@ur-cc.UUCP>
Reply-To: jesup@cbmvax (Randell Jesup)
Organization: Commodore, West Chester, PA
Lines: 18