@Anonymous wrote:
After running: (setq fl (open "c:/braintree/MapName.txt" "r")
line (read-line fl)...
Variable "line" is : "K:\\TOB\\GIS\\MAPS (BASE ETC)\\13YrRoadConstruction.dwg"
I need to substitue .... every instance of "\\" with "\" so it looks like:
("SERVER:\TOB\GIS\\MAPS (BASE ETC)\13YrRoadConstruction.dwg")
Unfortunately "\" is a special character which requires special attention. It's the special attention that I just can't figure out. ....
It's a special character that displays in AutoLisp returned values as a double backslash as @john.uhden already mentioned, but it's not really a double one. I reiterate @hak_vz 's question -- do you really need to change it?
It's coming from a file that already exists with a line with single backslashes in that file, though it displays when brought into AutoCAD with double ones. Depending on what you want to do with it, you probably don't need to change it. I did an experiment, making a little junk text file whose contents look like a filepath, with single backslashes:

Then I did this:
Command: (setq file (open "C:\\temp\\junk.txt" "r")); open that file to read from
#<file "C:\\temp\\junk.txt">
Command: (setq file2 (open "C:\\temp\\junk2.txt" "w")); open another to write to
#<file "C:\\temp\\junk2.txt">
Command: (setq line (read-line file)); read the first file's first [only] line:
"C:\\one\\two\\three" {note the displayed-as-double backslashes, though they're single in the file}
Command: (write-line line file2); write that line to the other file
"C:\\one\\two\\three"
Command: (close file)
nil
Command: (close file2)
nil
Then the contents of the other file are:

the same as in the first file, with the single backslashes, even though all "transactions" in AutoCAD displayed them as double.
Then I did this:
(command "_.text" "_mc" (getvar 'viewctr) "" "" line)
and the result in the middle of the screen was:

with the single backslashes! So actual usage as a text string does not have them doubled.
So do you really need to convert the displayed-as-but-not-really-double backslashes to single ones? What are you doing with the filepath string?
Kent Cooper, AIA