If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Moderators: Pete , Mods
izidor
Veteran
Posts: 110 Joined: Wed Apr 22, 2009 3:13 am
Contact:
Post
by izidor » Sun May 10, 2009 2:18 pm
Lets say that i have folder named text and in it there is text.txt.Here is my question how to open file from specific folder without writing "C:\..." or "D:\..."?
bongomeno
Veteran
Posts: 266 Joined: Wed Dec 10, 2008 9:08 am
Location: Arizona
Contact:
Post
by bongomeno » Sun May 10, 2009 3:41 pm
unless it is in the same folder as the program opening it, the file must have the C:\whatever\.
if the program is trying to access a file within a folder in the programs folder then you can do it like this (assuming your prog is in c:\f\) -
c:\f\folder\file.ext
OR
\folder\file.ext
izidor
Veteran
Posts: 110 Joined: Wed Apr 22, 2009 3:13 am
Contact:
Post
by izidor » Mon May 11, 2009 6:59 am
Thanks for reply. When i was searching net i found another solution command CHDIR.
DDastardly71
Coder
Posts: 22 Joined: Fri Oct 17, 2008 6:56 pm
Location: U.S.A.
Post
by DDastardly71 » Wed Jun 17, 2009 11:54 am
If the folder is in the same directory as your program, you can use relative instead of absolute path and without using CHDIR.
Works...
OPEN "text\text.txt" FOR INPUT AS #1
Will not work...this is an incomplete path as shown from the previous reply.
OPEN "\text\text.txt" FOR INPUT AS #1