Page 1 of 1
ReadFile the good file
Posted: Tue Jan 21, 2025 12:27 pm
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

Re: ReadFile the good file
Posted: Tue Jan 21, 2025 12:36 pm
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$))
Re: ReadFile the good file
Posted: Tue Jan 21, 2025 12:50 pm
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:
Re: ReadFile the good file
Posted: Tue Jan 21, 2025 1:59 pm
by SPH
Big Thx To You !!
Re: ReadFile the good file
Posted: Tue Jan 21, 2025 4:59 pm
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

.