| Author |
newbe q.: How to read windows path names from a file ?
|
|
| Damian 2006-03-31, 8:02 am |
| hi group!
I'm trying to [get $channel line] from a file containing lines with
something like "c:\Program files\file.ext". after successful reading
$line variable obviously contains "c:Program filesfile.ext". I'd like
to have "c:/Program files/file.ext" instead (maybe after a string
replacement). How to use "gets" to read a line and to read it without
treating "\" character as a special character or with on-the-fly
conversion to "/" character?
Thnx in adv.,
Damian
| |
| Paul Whitfield 2006-03-31, 8:02 am |
| Damian wrote:
> hi group!
>
> I'm trying to [get $channel line] from a file containing lines with
> something like "c:\Program files\file.ext". after successful reading
> $line variable obviously contains "c:Program filesfile.ext". I'd like
> to have "c:/Program files/file.ext" instead (maybe after a string
> replacement). How to use "gets" to read a line and to read it without
> treating "\" character as a special character or with on-the-fly
> conversion to "/" character?
NO NO NO ... gets does no such thing!
gets $channel line
set converted [ file normalize $line ]
Should convert the file to have "/" characters
Paul
| |
| Bryan Oakley 2006-03-31, 8:02 am |
| Damian wrote:
> hi group!
>
> I'm trying to [get $channel line] from a file containing lines with
> something like "c:\Program files\file.ext". after successful reading
> $line variable obviously contains "c:Program filesfile.ext".
There's nothing obvious about that.
When you read data, no substitutions are performed so your 's will
remain intact. gets will _not_ transform the data it reads (other than
line endings under certain circumstances)
If you are having the problem you say you are having, show us your
actual code, data and results and we'll help you figure it out.
--
Bryan Oakley
http://www.tclscripting.com
|
|
|
|