Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: gwbasic writing to a file in a different directory.  (Read 4115 times)

0 Members and 1 Guest are viewing this topic.

topsy99

    Topic Starter


    Beginner

    gwbasic writing to a file in a different directory.
    « on: August 05, 2016, 10:28:01 PM »
    i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder

    could someone tell me the line to write to the correct directory.      e.g. c:form\fred

    i use it on 32 bit vista .



    OPEN "B:TEMP" FOR INPUT AS #1



    it is writing my file to the windows directory system32 and i am unable to set up a short cut to this and have to look for it and it takes too long.  i need the file to write to a normal folder so that i can put a shortcut and to read the output quickly.

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: gwbasic writing to a file in a different directory.
    « Reply #1 on: August 05, 2016, 10:50:58 PM »
    i am re using one of my old gwbasic files but it save/writes to the wrong directory/folder

    OPEN "B:TEMP" FOR INPUT AS #1

    it is writing my file to the windows directory system32

    The line above is a file your BASIC program is reading from, not saving to.


    Right click and open the properties of your shortcut.
    Look for a box with the name "Start in:"

    Type the path you want your file saved to in that box.  Save and test that.  Don't make any typing errors. ;)

    That may or may not work - it depends on the script and aspects of your computer.

    topsy99

      Topic Starter


      Beginner

      Re: gwbasic writing to a file in a different directory.
      « Reply #2 on: August 05, 2016, 11:16:46 PM »
      i cant quote the actual line e.g. opening or writing as i am on a windows 10 computer at present away from home and cant replicate the line.

      the file is on this computer but windows says cant read due to this being 64 bit.

      will try your solution when i get home.

      thanks

      topsy99

        Topic Starter


        Beginner

        Re: gwbasic writing to a file in a different directory.
        « Reply #3 on: August 05, 2016, 11:58:04 PM »
        in further explanation.  My gwbasic comes up on a shortcut.   i then run the gwbasic file     it then saves to a txt file.    but i want the txt file to save in a different directory.       assume.     fred to be the current directory   i want it to save to c:\harry   how do i tell it in the open file line.


        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: gwbasic writing to a file in a different directory.
        « Reply #4 on: August 06, 2016, 12:02:34 AM »
        Quote
        assume.     fred to be the current directory   i want it to save to c:\harry   how do i tell it in the open file line.

        Enter the full path.

        Code: [Select]
        OPEN "C:\harry\file.txt" FOR OUTPUT AS #1
        I was trying to dereference Null Pointers before it was cool.