Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!unido!sbsvax!roeder From: roeder@robin.cs.uni-sb.de (Edgar &) Newsgroups: comp.sys.atari.st.tech Subject: Re: How to write config info into mail .PRG or .ACC file? Message-ID: Date: 22 Aug 90 15:53:34 GMT References: <3300@syma.sussex.ac.uk> <25854@cs.yale.edu> Sender: news@sbsvax.cs.uni-sb.de Organization: Universitaet des Saarlandes, Saarbruecken (W-Germany) Lines: 34 In-reply-to: fischer-michael@cs.yale.edu's message of 22 Aug 90 01:10:34 GMT In article <25854@cs.yale.edu> fischer-michael@cs.yale.edu (Michael Fischer) writes: In article <3300@syma.sussex.ac.uk> grahamt@syma.sussex.ac.uk (Graham Thomas) writes: > >My options are either to read from / write to a separate .CFG or .INF >file, which I could do but would rather not (I've incorporated my >resource file info into the main program file and I'd like to keep >everything in a single place if possible), or save the info directly to >the program itself. How is this done? I don't know of a reliable way to find the name and location of the .prg file which is currently running. It will often be in the default directory on the default device (depending on how the program was invoked), but it doesn't have to be. The Pexec that invokes your program probably leaves this information behind in some undocumented memory locations somewhere, but you can't count on that not changing in the future. If the program is launched by the desktop, you can find out it's name and path by calling shel_read. This function expects two parameters: the first array of characters is filled with the path of the current program, the second array of chars will contain the arguments supplied by the TTP-box or the "Install application"-feature. If your program is launched by some shell, you could look at argv[0] supplied by one of the extended argument passing methods (eg. xArg or ARGV environment vars). You could also search for your programs name (obtained from argv[0] or your default name) in the directories specified in the PATH environment variable. As a last resort, you could prompt the user for the location of the program. Hope this helps. - Edgar