[plt-scheme] Windows and file I/O

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Oct 20 10:13:52 EDT 2006

Another possibility: look up how paths work (see Helpdesk) to make  
the program more portable. -- Matthias


On Oct 20, 2006, at 9:48 AM, Eli Barzilay wrote:

> On Oct 20, Chris Gehlker wrote:
>> I hope really newby questions  are  tolerated here.
>>
>> I'm trying to learn Scheme from the "Teach Yourself Scheme in Fixnum
>> Days" and I'm at the part about file I/O. I mostly use the  Mac and
>> everything seems to work there because Scheme accepts unix path
>> names. But when I  tried to move a toy application to Windows and use
>> forms like:
>>
>> (open-output-file "C:\Documents and Settings\Chris Gehlker\My
>> Documents\greeting.txt")
>>
>> I get an "unknown escape sequence \D in string" error. How do I
>> specify paths in Windows without Scheme interpreting the backslashes
>> as escapes?
>
> Just like in many other languages, use
>
>   (open-output-file "C:\\Documents and Settings\\Chris Gehlker\\My  
> Documents\\greeting.txt")
>
> or
>
>   (open-output-file "C:/Documents and Settings/Chris Gehlker/My  
> Documents/greeting.txt")
>
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli  
> Barzilay:
>                   http://www.barzilay.org/                 Maze is  
> Life!
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.