mIRC Homepage
when writing to a file using $mircdir $+ %filename and if $mircdir contains a space eg c:\program files\mirc\ then in fact the file does not receive the data and remains empty.
What is the solution to this problem?
thanks lerp
Try $+(",$mircdir,%filename,")
Yes, that works,thanks !
But why?
Most commands that take a filename parameter require that quotes surround the path if it contains spaces. This does not apply to $identifiers however.

This is simply how Khaled coded it. For commands like /write, it is the only way to destinguish the filename from the data to be written to the file. Allthough /remove only has a file parameter, it too requires quoted paths.

Alternately, some users prefer doing $shortfn(path with spaces), which never needs quoting. Though I think it's yucky. smile

- Raccoon
Quote:

$shortfn(path with spaces), which never needs quoting. Though I think it's yucky.


Likely uses alot more processor time to deal with as well,
take the long name, of the first folder get its short filename, move on to the next subfolder and repeat, finally getting the shortfilename, it might be a internal to windows thing, but still has to be done, then when its used, i would liekly think windows has to work out the short to long ones again to get the file, (maybe not once you have the shortfn as win fat dir format at least had long and short filename entries, i dont know if ntfs does as well)
$shortfn won't work if the file doesn't already exist either.

If the file is in $mircdir $+($mircdir,file.ext) you can also omit the $mircdir and use file.ext
Unless $scriptdir != $mircdir in which case $mircdir would need to be used. grin
Quote:
when writing to a file using $mircdir $+ %filename and if $mircdir contains a space

It doesn't matter an iota where $scriptdir points if you use $mircdir. grin
Hmm, my mistake. I seem to remember the default path pointing to $scriptdir and not $mircdir, whenever a script existed outside of $mircdir. But it doesn't, so I remembered wrong. crazy

Omit $mircdir all you want. blush
Just the opposite, if you use $scriptdir outside of a script (from commandline) it returns [ [ $mircdir ] ] smile
© mIRC Discussion Forums