[comp.sys.amiga.tech] Programming Question

ricker@proton.uucp (Greg Ricker) (08/25/89)

I have a question regarding opening a window on a custom screen. I am using the 
examples from the "Programmers Guide to the Amiga" , chapter four(pgs 118-119).

The example calls for using the OpenScreen function followed by the OpenWindow 
function. Redefining window.Screen to point to the customscreen and window.Type toCUSTOMSCREEN is required before calling OpenWindow.
The call to OpenWindow fails when window.Type is set to CUSTOMSCREEN. If 
window.Type is left set to WBENCHSCREEN then the customscreen is opened over the
window but without any way to close the window. It dosen't appear to be failing 
due to insufficient memory (~600K available before running the program).

System Conf:
Amiga 2000 w/1meg  (Rev 6)
Quantum 40 meg drive w/Trumpcard controller

Thanks in advance


References: 
Sender: 
Reply-To: ricker@proton.uucp (Greg Ricker)
Followup-To: 
Distribution: usa
Organization: Loma Linda U. Rad. Research Lab, Loma Linda
Keywords: 


-----------------------------------------------------------------------------
Radiation Research Lab		|Internet: ricker%proton.UUCP@ucrmath.UCR.EDU
Loma Linda Universtiy Medical Center |        UUCP: ...ucrmath!proton!ricker
Loma Linda, California. (714)824-4066|

gest_ltd@uhura.cc.rochester.edu (Gavin Stark) (07/06/90)

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.


Gavin Stark.
gest_ltd@uhura.cc.rochester.edu

kevin@cbmvax.commodore.com (Kevin Klop) (07/07/90)

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.
>
>
>Gavin Stark.
>gest_ltd@uhura.cc.rochester.edu


Under OS revision 2.0, you can look in ProgDir: to access files in the same
directory as the one that your program was launched from.

If you want to do it, the code is a little bit tougher...

			-- Kevin --


Kevin Klop		{uunet|rutgers|amiga}!cbmvax!kevin
Commodore-Amiga, Inc.

	``Be excellent to each other.''
		- Bill and Ted's most excellent adventure

Disclaimer: _I_ don't know what I said, much less my employer.

jesup@cbmvax.commodore.com (Randell Jesup) (07/10/90)

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

dick@woodwrk.UUCP (Richard H. Wood) (07/11/90)

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

jesup@cbmvax.commodore.com (Randell Jesup) (07/13/90)

In article <dick.3311@woodwrk.UUCP> dick@woodwrk.UUCP (Richard H. Wood) writes:
>>In article <13119@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>>	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. ;-)

	Only if the shell lets the command see that path.  The standard
Commdore Shell (and CLI) don't, and most other shells don't (though perhaps
one or two do).  If the startup code can't see the shell command-line, it
can't use it.  I'm fairly sure this isn't tightly specified in ANSI, I suspect
it's merely listed as "command name", with no reference to paths, aliases, etc,
which are all system-dependant.

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