|
Post by jarych on Aug 1, 2022 9:30:54 GMT
Here is an example program to show how to manage files in a folder located inside the BAS's default directory. WHY? A cleaner way to manage and store a file which the BAS program creates, produces, or changes. Better than finding the file or files among the many other files necessary in case programmer later wants to distribute the BAS (or packaged TKN and renamed EXE) to other people to use.
'filetosubfolder study 'learn to output a file into a folder located in BAS's default directory 'folder to test here is called foldindef 'SUCCESS! Aug. 1, 2022 2AM
sname$=""
print "Let us output a test file and put into subfolder foldindef located" print "in our default program directory." input "Give a simple name for new file. ";sname$ input "Give a common name as part of field 1 record. ";comname$ input "Give a piece of numeric data such as a date as mmddyyyy or something part of . ";dnum$ print
if sname$="" then END
open DefaultDir$+"\foldindef\"+sname$+".txt" for output as #nfile print #nfile,comname$;",";dnum$ close #nfile
print "File ";sname$;" is made. Go check through using Windows. " END
A "tip" is shown there, in that the variable, DefaultDir$ does not contain an automatic backslash, and that person who writes JB code needs to write it into the code line himself. See, in the line, "\foldindef\".
|
|