It might be easier to just ask the user to put your program and his input file, into the same directory. You're using QuickBasic, right?
Originally Posted by Raghavan
A while loop can also find that path, if that's not possible:
It will be 1 based, not zero-based.
i = len(pathWithFilestring$
while (mid$(pathWithFilestring$, i, 1) <> "\")
i = i - 1
'Now you have the last backslash in the path, which is also it's last character before the filename.
'getting the rest of the path
path$ = left$(pathWithFilestring$, i)
'now add the filename:
path$ = path$ + "output.txt"
That's off the cuff, but you get the idea. If you want more help with it, let me know. I have QuickBasic, still.