C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
_pgmptr
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
  Variable:  _pgmptr
 
  Syntax:    extern char __far * _pgmptr;
 
     The _pgmptr variable is automatically initialized at startup to
     point to the drive, path, and filename of the executing program.
     It is defined as a global variable in the run-time library and
     declared in CRT0DAT.ASM, which is part of the startup code.
     This code is linked in to any module that contains a main()
     function. Declaring _pgmptr in your own code is all that is
     required to make the drive, path, and filename of the executing
     program available to your program.
 
  Example:
 
     #include <stdio.h>
 
     extern char far *_pgmptr;
 
     void main( void )
     {
         printf("The full path of the");
         printf(" executing program is : %Fs\n", _pgmptr);
     }
                                    -♦-