Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!convex!iex!ntvax!jbeard From: jbeard@ntvax.uucp (Jeff Beardsley) Newsgroups: comp.sys.ibm.pc Subject: Re: Where oh where does my program reside?? Keywords: the and if then where who what when why how question answer Message-ID: <1989Oct25.183738.15420@ntvax.uucp> Date: 25 Oct 89 18:37:38 GMT References: <1407@sdcc13.ucsd.edu> Reply-To: jbeard@ntvax.UUCP (Jeff Beardsley) Organization: University of North Texas Lines: 24 In article <1407@sdcc13.ucsd.edu> pa1256@sdcc13.ucsd.edu (Jennifer's Lover) writes: >I have a question regarding how to pull some information out of DOS. > >I want to know, regardless of the current directory, what directory >my program resides in. > Well, since you are using C, this is no problem. The following code fragment will print out your program's pathname: main(argc,argv) int argc; char **argv; { printf(argv[0]); } This will be a Full pathname, in the normal form: "C:\USR\JBEARD\TEST.EXE", etc, Since you are in DOS 3.x this is usable, previous versions would print "C:TEST.EXE". -- -------- Jeff Beardsley at UNT ----------- --------