🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Programming Question

#4325
From: Richard H. Wood
Date: Wed, 11 Jul 1990 12:27
36 lines
2210 bytes
>In article <13119@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>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.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Not much of a consolation, but:  Don't all C's return the entire string
(i.e., the command part of the command-line) in arg[0]?  I haven't
tried this with Aztec 5.0, but on VAX C it appears to (on a VMS
machine).  If you checked this first and found a path, you wouldn't
even have to do your second(third ?)-guess routine. ;-)


>
>-- 
>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!"

--
               -----------------------------
|\    |  |    | Become  an                  |  uunet!digi!woodwrk!dick
|/ick |/\|ood |              ORGAN   DONOR  |  dwood@digi.lonestar.org
               -----------------------------
--
Technical Details
Message-ID: <dick.3311@woodwrk.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!texsun!digi.lonestar.org!woodwrk!dick
References: <8180@ur-cc.UUCP> <13119@cbmvax.commodore.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!sun-barr!newstop!texsun!digi.lonestar.org!woodwrk!dick
From: dick@woodwrk.UUCP (Richard H. Wood)
Newsgroups: comp.sys.amiga.tech
Subject: Re:  Programming Question
Message-ID: <dick.3311@woodwrk.UUCP>
Date: 11 Jul 90 12:27:32 GMT
References: <8180@ur-cc.UUCP> <13119@cbmvax.commodore.com>
Lines: 36