Search code examples
savedirectorychdirqbasicgw-basic

why is the function CHDIR not working on the network ? Qbasic BasicA


I have a .bas file that I run using GWBASIC.EXE

The .bas file uses other files located in the path : \srv120 (T:)\Basic

(GWBASIC.EXE and the .bas file are also in the same directory T\Basic)

In the directory T\Basic, I've created another folder called "Calcultext" (T:\Basic\Calcultext)

My problem is :

The .bas file contains the following code (its only a part of the file)

1131 CHDIR " T:\Basic\Calcultext\ " 
1132 OPEN "Gisement.txt" FOR APPEND AS #2 
1133 PRINT #2, USING "* A=##### \        \ XA=#######.### YA=#######.###                                                        
*";I,NA$,XA#,YA# 
1134 CLOSE #2 
1135 CHDIR " T:\Basic\ "

When I run the program, i get an error at line 1131.

If i remove line 1131 (and 1135), everything works fine, a new text file ("Gisement.txt") is created in the following path : T:\Basic

However, i can't manage to change directory to save the text file in the folder "Calcultext" located in the folder T:\Basic.

I hope everything is clear enough,

Thank you for your answers !


Solution

  • The solution is:

    1131 CHDIR "T:\Basic\Calcultext\" 
    1135 CHDIR "T:\Basic\"
    

    instead of

    1131 CHDIR " T:\Basic\Calcultext\ "
    1135 CHDIR " T:\Basic\ "
    

    The space before and after the path shall be removed.