|
Post by DARKNIGHT on Jun 19, 2023 21:02:32 GMT -5
UPDATE: with the help of Rod, This problem has been solved.
see his code below if you are having a similar dilemma. Thanks Rod!
********************************************************
|
|
|
Post by Rod on Jun 20, 2023 3:08:59 GMT -5
There are a few issues to think about. Firstly to create and write to a file there are three components to the file name. The path, the file name and the .extension. So subjects\rod is not a file name but subjects\rod.dat is. subjects\bird\rod.dat is a sub directory bird with file rod.dat
Secondly you are always starting somewhere on the PC, not usually c: So Liberty gives us DefaultDir$ as a system variable that tells us where the program is in the PC's directory structure. You can use explicit directory paths but that may not be the same on a different computer or for a different user.
Thirdly you cant create a directory or sub directory more than once you will need to check for its existence or the files existence first.
Have a play and ask again if puzzled.
data$(1)="Rod" data$(2)="Bird" ID$="Bird" print DefaultDir$
[Create_Folders] Path$=DefaultDir$;"\SUBJECTS" result= mkdir(Path$)
[Write_Data] print Path$;"\";ID$;".dat" open Path$;"\";ID$;".dat" for OUTPUT AS #1 for d=1 to 2 print #1,data$(d);","; next d print #1,ID$; close #1
open Path$;"\";ID$;".dat" for input as #1 line input #1,d$ print d$ close #1
wait
|
|
|
Post by DARKNIGHT on Jun 20, 2023 14:20:00 GMT -5
Much Thanks Rod! that works great. I also copied and pasted your code into a notepad doc, for future reference.
I will keep what you said about path structure in mind, so I dont have to keep posting simular problems. Thanks Again, Jim
|
|