Hello,
I need to put in a char const a full Windows path to a file.
I.e. i did it as follows
fopen ("..\path\filename", "r");
It puts down some warnings about unknown escape characters.
So I rewrite it to :
fopen ("..\\path\\filename", "r");
Is this correct?
Thank you
Jan Mura
jan...@vo...
From: Chris M. <lor...@gm...> - 2008-03-29 17:57:02
On Sat, Mar 29, 2008 at 8:46 AM, Jan Mura <jan...@vo...> wrote:
> Hello,
>
> I need to put in a char const a full Windows path to a file.
> I.e. i did it as follows
>
> fopen ("..\path\filename", "r");
>
> It puts down some warnings about unknown escape characters.
> So I rewrite it to :
>
> fopen ("..\\path\\filename", "r");
>
> Is this correct?
Yes, that is correct.
The '\' character is an escape character, used to make characters that
are special (eg '\'' get's me a single quote mark).
By escaping the escape character you get a single backwhack.
--
Registered Linux Addict #431495
http://profile.xfire.com/mrstalinman | John 3:16!
http://www.fsdev.net/ | http://lordsauron.wordpress.com/
The "native" way is the one you selected, i.e. dual backslash.
However, the "compatible" whay to do it is to use a single forward slash
instead, i.e. "../path/filename".
The C RTL on Windows will automagically translate the forward slash into a
backward slash before sending the string to the OS.
/pwm
On Sat, 29 Mar 2008, Jan Mura wrote:
> Hello,
>
> I need to put in a char const a full Windows path to a file.
> I.e. i did it as follows
>
> fopen ("..\path\filename", "r");
>
> It puts down some warnings about unknown escape characters.
> So I rewrite it to :
>
> fopen ("..\\path\\filename", "r");
>
> Is this correct?
>
> Thank you
>
> Jan Mura
> jan...@vo...
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>