|
|
Escape Character in directory path
Hi
I need to pass a path to FindFirstFile() that is specified by the user,
problem is that all \ characters need to be prefixed with another \, what is
the easiest way to do this short of scanning the entire string and replacing
a \ with \\.
Kind Regards
Rich Strang
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
riky_rang (8)
|
1/4/2004 11:43:42 PM |
|
Rich Strang wrote:
> Hi
>
> I need to pass a path to FindFirstFile()
This is a Windows function, not a standard C++ function. Discussion of
platform-specific libraries should generally be done on other groups.
> that is specified by the user, problem is that all \ characters need to be
> prefixed with another \,
No they don't. That is something you need to do in source code, not in
memory.
> what is the easiest way to do this short of scanning the entire string and
> replacing a \ with \\.
Tell the user to do it. ;-)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Ben
|
1/5/2004 9:50:04 PM
|
|
Rich Strang wrote:
> Hi
>
> I need to pass a path to FindFirstFile() that is specified by the user,
> problem is that all \ characters need to be prefixed with another \, what is
> the easiest way to do this short of scanning the entire string and replacing
> a \ with \\.
Actually, you don't need to do a thing. The string containing
\ characters is just fine.
The problem you may be thinking about is with *literal* strings
in your program. It's not the fact that the string contains \
characters: the problem is precisely that the string DOES NOT
contain the \ characters that it should:
"c:\temp\total.txt"
Does not contain a single \ character -- it does contain two
TAB characters, though. But if the user enters the above
string, then your string variable will indeed contain the
two \ characters and everything will work fine.
BTW, it is normally recommended to use / for paths -- either
on Unix/Linux or on DOS/Windows, it works. This, of course,
applies to *literal strings* in your program containing
paths. For instance:
"c:/temp/total.txt"
will work fine.
HTH,
Carlos
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Carlos
|
1/5/2004 9:59:55 PM
|
|
|
2 Replies
560 Views
(page loaded in 0.042 seconds)
Similiar Articles: Escape Character in directory path - comp.lang.c++.moderated ...Hi I need to pass a path to FindFirstFile() that is specified by the user, problem is that all \ characters need to be prefixed with another \, what ... list name of current FOLDER not full path - comp.soft-sys.matlab ...... The POSIX rule is that two (or more) leading // signals a file-system escape. ... Prompt to show directory - comp.unix.solaris How to display complete path of the directory in ... escaping directory name space - comp.unix.shell... dropping the directory onto a terminal loaded the path ... when the source path has an escape ... preferred syntax/escape for handling the ... Spaces and special characters ... "Moderated" List??? - comp.lang.asm.x86"Moderated" List??? - comp.lang.asm.x86 list name of current FOLDER not full path - comp.soft-sys.matlab ... Escape Character in directory path - comp.lang.c++.moderated ... INSERT PICTURE INTO A CONTAINER FIELD DYNAMICALLY - comp.databases ...Make sure you use slashes, because FMP7 uses backslashes as escape characters. ... returned as a container, would be: ImageFile = "image:/c:/path/to/image/directory ... imported file name - comp.databases.filemaker... at a time, you will see the file name and path as ... step to call a DOS command: "cmd /c dir >directory.txt ... Also note that "\" is a filemaker "escape" character so \\ in ... how to clear screen in unix - fn. similar to clrscr() in DOS ...... call unlink(path), and it's done. To delete the directory ... simple one character commands! That first led to every manufacturer using their own private set of "escape ... ln-s does not work.. why? (using cygwin in Windows XP) - comp.unix ...... symlink>=FF=FE\.... with some control characters.. I can't cd to that directory ... became buggy with the expansion of escape ... should not single-quote the target path ... Need a FORTRAN compiler for Win7 (or XP) - comp.lang.fortran ...The entire path. > > ... > .... > >> I see C:\WATCOM ... binnt> ..\docs\ C:\OWATCOM\docs> dir *.pdf Directory of ... more ways for passing dummy argument aliasing, escape ... problem in interface - comp.lang.fortran... FC) -c MAIN/lm-lib.f90 THIS IS DONE IN LMTO-A directory ... this route it seems clear it's time to look for a path ... Want Escape to dismiss JDialog - comp.lang.java.gui ... Escape Character in directory path - C / C++Escape Character in directory path. C / C++ Forums on Bytes. ... Hi I need to pass a path to FindFirstFile() that is specified by the user, Escape Character in directory path - comp.lang.c++.moderated ...Hi I need to pass a path to FindFirstFile() that is specified by the user, problem is that all \ characters need to be prefixed with another \, what ... 7/23/2012 1:12:06 AM
|
|
|
|
|
|
|
|
|