This message was edited by DrMarten at 2005-8-19 18:44:41
: : Using QuickBasic 7.1 on WinXP. My program will OPEN <filename.dat> just fine if the file is in the same directory as QBX.exe, but not if it is in another directory. For example:
: :
: : OPEN "<filename.dat>" FOR BINARY AS #1
: :
: : works just fine. But:
: :
: : OPEN "C:\<directory>\<sub-directory>\<filename.dat>" FOR BINARY AS #1
: :
: : (or other variations, such as omitting drive letter, putting only <filename.dat> in quotes, etc.) gives path errors.
: :
: : Is there a way to do this?
: :
:
: Probably, the problem is, that your filename or directories have names longer than 13 characters. Ovbiously, DOS doesnt support long filenames, so the solution is to make short filenames:
:
: For example:
: OPEN "C:\Myfoldernumber1\importantstuff\Iwantfilehere\Filename.dat" FOR BINARY AS #1
: Should be:
: OPEN "C:\Myfold~1\import~1\Iwantm~1\Filename.dat" FOR BINARY AS #1
:
: If you have spaces in your filenames or if the above doesnt work, then Im clueless.
:
=================
I have not looked at QBasic for ages but is there a SETPATH or a PATH= command?
You might be able to use a string in the OPEN command like
OPEN A$
and set A$ to one of the strings you typed.
To find out how your PC stores a filename in the 8.3 mode of DOS go to>
START then RUN
type in CMD to open a DOS window
Look at the appropriate directories using CD and DIR as usual
If a filename you know is longer (within Windows) it will appear with the "~" character in it which is SHIFT with the # key (next to BACKSPACE) on a UK keyboard.
Hope this helps?
Regards,
DrM