path in Quickbasic

How can I get the path in Quickbasic?



For example, a program that opens file "text.txt" is located on "c: emp". Also the file "text.txt" is located on that directory. If I run the program from "c:" with command c: empprogram.exe , the program tries to open c: ext.txt .



So, what do I need to do to tell the program that the file is located on the same directory that the program itself?


Comments

  • chdir path$



    I have to put this here so the message post will be longer. I guess he got tired of people just putting blank messages up on the server... ok, that should do it. =) if you have any other questions, just post, and I'll try to help you, but I won't do your homework. (be crafty in your representation, and I just might) :-)



    enjoy.


  • From the command line:



    CD TEMP



    then run your program.



    When you specify a path for executing a program, even if it's a relative path, the OS will not change directories but will run the program from where it is.



    Of course, one other way of doing this is to specify a path in the file itself:



    OPEN "C:TEMPTEXT.TXT" FOR BINARY ACCESS READ AS FileHandle



    which will work just fine no matter what directory you run the program from.



    -nek


    URL:http://lss.zext.net/

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories