Howdy,
I need to print given path to a file. The problem is that my app is platform independent -> I can get a Win32 style path:

C:\foo\bar.dat

.

The problem is with printing single backslashes '\' -> single char converts to "\char" style. I need to convert it somehow to proper style "\\" in order to print it. I was thinking about some lib function (dir.h, sys_*, etc.), but I had no luck.

Any help appreciated! :)

You can use / in both MS-Windows and *nix. C:/foo/bar.dat

If you still want to use \, then the only time you need \\ is in string literals which are surrounded by quotes. Paths read from a file or returned by some other function do not need \\.

Edited 6 Years Ago by Ancient Dragon: n/a

You can use / in both MS-Windows and *nix. C:/foo/bar.dat

If you still want to use \, then the only time you need \\ is in string literals which are surrounded by quotes. Paths read from a file or returned by some other function do not need \\.

Yes, '/' or '\' are both valid.

I completely forgot that "\\" is needed only in string literals... I'm sorry and thank you for your quick response.

This question has already been answered. Start a new discussion instead.