Just starting out? Need help? Post your questions and find answers here.
-
SPH
- Enthusiast

- Posts: 593
- Joined: Tue Jan 04, 2011 6:21 pm
Post
by SPH »
hi,
in a software developed in PB (obviously), I say this:
But I would like to find the file "000.txt" where my EXE is and not at the hard path.
What magic instruction do you suggest?
Thx

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
-
matalog
- Enthusiast

- Posts: 305
- Joined: Tue Sep 05, 2017 10:07 am
Post
by matalog »
GetCurrentDirectory() will return the directory that the .exe is held in.
Code: Select all
fold$= GetCurrentDirectory()
file$= "000.txt"
Debug fold$+file$
Readfile(7,fold$+file$)
Or depending on how you are using the program, you may want to:
Code: Select all
Temp$ = ProgramParameter()
SetCurrentDirectory(GetPathPart(temp$))
-
Kiffi
- Addict

- Posts: 1509
- Joined: Tue Mar 02, 2004 1:20 pm
- Location: Amphibios 9
Post
by Kiffi »
matalog wrote: Tue Jan 21, 2025 12:36 pm
GetCurrentDirectory() will return the directory that the .exe is held in.
No!
better use:
Hygge
-
SPH
- Enthusiast

- Posts: 593
- Joined: Tue Jan 04, 2011 6:21 pm
Post
by SPH »
Big Thx To You !!
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
-
matalog
- Enthusiast

- Posts: 305
- Joined: Tue Sep 05, 2017 10:07 am
Post
by matalog »
Kiffi wrote: Tue Jan 21, 2025 12:50 pm
matalog wrote: Tue Jan 21, 2025 12:36 pm
GetCurrentDirectory() will return the directory that the .exe is held in.
No!
better use:
Yes. This is a better answer

.