Filenames+containing+spaces

//by Richard Russell, May 2006//

You don't need to take any special precautions when using **OPENIN**, **OPENOUT** or **OPENUP** to access files whose names (or paths) contain one or more spaces:

code format="bb4w" filename$ = "Filename containing spaces" file% = OPENIN(filename$) file% = OPENUP(filename$) file% = OPENOUT(filename$) code However if you need to access such a file with a //**star**// command (or with **OSCLI**) then you should enclose the filename in quotes:

code format="bb4w" *DISPLAY "Filename containing spaces" *COPY "Source file" "Destination file" code When using **OSCLI** (typically because the filename is a variable rather than a constant) then you must add quotes around the filename(s) in the command string. There are two main ways of doing this, firstly by using the **CHR$34** character:

code format="bb4w" filename$ = "Filename containing spaces" OSCLI "DISPLAY "+CHR$34+filename$+CHR$34 srcfile$ = "Source file" dstfile$ = "Destination file" OSCLI "COPY "+CHR$34+srcfile$+CHR$34+" "+CHR$34+dstfile$+CHR$34 code and secondly by using the **""** sequence:

code format="bb4w" filename$ = "Filename containing spaces" OSCLI "DISPLAY """+filename$+"""" srcfile$ = "Source file" dstfile$ = "Destination file" OSCLI "COPY """+srcfile$+""" """+dstfile$+"""" code Forgetting to include the quotes can result in confusing (at first sight) symptoms. Some people find that the method using CHR$34 tends to produce clearer code and is easier to debug. Others prefer the compactness of the "" method. Use whichever you feel happier with.