Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find filename of running program 1

Status
Not open for further replies.

TheElusiveYak

Programmer
Feb 8, 2004
19
0
0
US
I am using pascal 5.5 and I'm writing a program that uses its own name as a variable. The problem is I cannot figure out how to get the actual filename of the program save to a variable. I can only seem to get the directory. Is this at all possible? Also on another note is there a wat to search out directories. Any help would be appreciated.
 
paramstr(0) should return the first paramter on the command line, and that is your exe-file. I can't remember if it comes back with the path or not, but I think it does. I've used it in Turbo Pascal 6.0 and expect it to work in 5.5 too. Also I can't remember what paramstr(0) returns if you run from the edit window rather than going to dos and typing the name of the program to start (don't worry: if you start by clicking in windows it's just like typing the command line)

 
paramstr(0) does indeed return the drive, full path and filename of the running executable. If you're running from the IDE, you will get the path to your executables directory.
To search directories, you can use findfirst and findnext in Turbo 7.0. I don't know if they exist in Turbo 5.5.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
Thank You, Your post helped to cross that roadblock.
That section of my program is now working superbly.
Thanx again.

The Elusive Yak
Nick Marshall
I never knew my grandfather, I was more concered about who his grandson will be. - Abe Lincon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top