Re: Doubling \\ in file names

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, 18 Jun 2003 17:58:09 +1200 (06/18/03 15:58:09)
, Ray Tomes <rtomes at ihug.co.nz> wrote:

>
>
> Hi All
>
> I think that I am having trouble because of needing to double back 
> slashes in a file name for various GUI commands such as extractIcon. If I 
> have a file name with single back slashes then is there some function 
> that will make them all double or am I doing something daft?
>
> What is the rule on what things treat "\" in text in this way (i.e. as a 
> special escape character)?  Is it always the case in all text strings, or 
> do some just have normal single "\" in file names?
>
> I am using create( PictureButton, ... and want to put an extractIcon(f) 
> command directly in as a parameter for the picture icon and it seems the 
> reason for failure is that f has single back slashes.
>

Hi Ray,
this has nothing to do with file names, that's just a red-herring. Inside 
string literals, the backslash character '\' has a special meaning. Certain 
two-character combinations are used to represent special characters. They 
are (from memory)...

\t	The TAB character \n	The new-line character
\\	The backslash character

This means that if you need to specify a backslash in a string you need to 
write it as a double \\.

Thus "C:\\Program Files\\My Application\\abc.dat" is converted by Euphoria 
to

C:\Program Files\My Application\abc.dat

The other combinations are useful for embedding new-lines and TABs inside 
strings.

Hope this helps.


-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu