How do I define the pathname to a file in WIndows 10
Brian K. White
brian at aljex.com
Tue Dec 8 11:46:37 PST 2015
On 12/8/2015 1:48 PM, Kenneth Brody wrote:
> On 12/8/2015 1:38 PM, Brian K. White via Filepro-list wrote:
>> On 12/8/2015 1:24 PM, Kenneth Brody wrote:
>>> On 12/8/2015 12:35 PM, Brian K. White via Filepro-list wrote:
>>>>
>>>>> or add quotes around the whole string because of the space in My
>>>>> Documents:
>>>>>
>>>>> tf = "\""getenv("USERPROFILE"){x{"My Documents"{x{"foo.txt\""
>>>>
>>>> Wups, missing a { between the first "\"" and getenv() :
>>>>
>>>> tf = "\""{getenv("USERPROFILE"){x{"My Documents"{x{"foo.txt\""
>>>
>>> ... which means that instead of getting a "syntax error" in filePro,
>>> you'll simply end up with an invalid filename.
>>>
>>> (USERPROFILE includes the drive letter, so you can't preface it with
>>> "\". And, if it didn't include a drive letter, you would now have a
>>> filename that starts with "\\", which in all likelihood would also be a
>>> failure.)
>>>
>>
>>
>> "\"" not "\"
>> It's to put quotes around the entire string because of the space in My
>> Documents. Not a leading backslash
>>
>> "C:\users\bkw\my documents\foo.txt"
>> vs
>> C:\users\bkw\my documents\foo.txt
>
> Oops. Mea culpa.
>
> However, unless you're passing it to SYSTEM, you can't include quotes in
> the filename. And, if you are passing it to SYSTEM, I would recommend
> that you add the quotes when passing it to SYSTEM, rather than when
> building the filename.
Good point. In order to use the "tf" variable for both fp io commands
like open() and then use it in system(), don't include the quotes right
in the variable. I was really just trying to show the necessary quoting
syntax not really show a line of code he would use verbatim, but you're
still right. It should be more like this:
tf = getenv("USERPROFILE"){"/My Documents/foo.txt"
h = open(tf,"wtc0")
...
x = close(h)
system "start \"" { tf { "\""
or thereabouts
Assuming directory write permissions outside of userprofile are even the
cause of his problem, which as you've pointed out we don't know because
he hasn't said.
--
bkw
More information about the Filepro-list
mailing list