Originally Posted by
Raghavan
Hi
I give my input through a file. so in my program i get the path of the file from user and manipulate the data in it. i want to place the output also in a file in the same place as my input file. for example my input file resides here G:\BC\BIN\input.txt i want the output file also in the same place like this G:\BC\BIN\output.txt
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?
A while loop can also find that path, if that's not possible:
Code:
i = len(pathWithFilestring$
while (mid$(pathWithFilestring$, i, 1) <> "\")
i = i - 1
wend
'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"
'check it
print path$
It will be 1 based, not zero-based.
That's off the cuff, but you get the idea. If you want more help with it, let me know. I have QuickBasic, still.