Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread Michele La Monaca
On Fri, Aug 22, 2014 at 9:06 PM, John Cowan co...@mercury.ccil.org wrote: Michele La Monaca scripsit: AFAICT, Posix systems treat text files as binaries even if you don't explicitly say so. Windows does not. That's true, but the only difference is that CR-LF is mapped to CR in text mode

Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread John Cowan
Michele La Monaca scripsit: So, let me understand, are you comfortable about that? $ cat -e f.txt ^Z1234$ (with-input-from-file f.txt read-line) ;; unix \x1a1234 (with-input-from-file f.txt read-line) ;; windows !eof It's annoying in principle, but not in practice. Text files don't

Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread Michele La Monaca
On Sun, Aug 24, 2014 at 7:22 PM, John Cowan co...@mercury.ccil.org wrote: Michele La Monaca scripsit: So, let me understand, are you comfortable about that? $ cat -e f.txt ^Z1234$ (with-input-from-file f.txt read-line) ;; unix \x1a1234 (with-input-from-file f.txt read-line) ;; windows

Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread John Cowan
Michele La Monaca scripsit: ... but binaries do. Yet, open-input-file will open them as text files in Windows and as binaries in Unix (by default). The short answer to that is that there is a way of opening binary files as binary: with (open-input-file foo #:binary) in Chicken,

Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread Michele La Monaca
On Sun, Aug 24, 2014 at 8:04 PM, John Cowan co...@mercury.ccil.org wrote: Michele La Monaca scripsit: ... but binaries do. Yet, open-input-file will open them as text files in Windows and as binaries in Unix (by default). The short answer to that is that there is a way of opening binary

Re: [Chicken-users] open-input-file and binary mode

2014-08-24 Thread John Cowan
Michele La Monaca scripsit: On the same page at last. On my first mail I was just asking to make (open-input-file FILE #:binary) the default behaviour (it is already so in Unix given there's no such a text mode there). Bad idea? I think so. The default mode of open-input-file should read

[Chicken-users] open-input-file and binary mode

2014-08-22 Thread Michele La Monaca
Hi, I think it would be better to change open-input-file default mode to binary. While Posix systems doesn't care, on non-Posix ones ftell and fseek might not work properly. For example, on Windows: $ cat f.txt 1 2 3 4 (call-with-input-file f.txt (lambda (p) (read-string 4 p) (file-position

Re: [Chicken-users] open-input-file and binary mode

2014-08-22 Thread John Cowan
Michele La Monaca scripsit: I think it would be better to change open-input-file default mode to binary. Over my dead body. The last thing I want is random CRs in text files. While Posix systems doesn't care, on non-Posix ones ftell and fseek might not work properly. In practice the only

Re: [Chicken-users] open-input-file and binary mode

2014-08-22 Thread Michele La Monaca
On Fri, Aug 22, 2014 at 6:20 PM, John Cowan co...@mercury.ccil.org wrote: Michele La Monaca scripsit: I think it would be better to change open-input-file default mode to binary. Over my dead body. The last thing I want is random CRs in text files. Can you elaborate this sentence, please?

Re: [Chicken-users] open-input-file and binary mode

2014-08-22 Thread John Cowan
Michele La Monaca scripsit: AFAICT, Posix systems treat text files as binaries even if you don't explicitly say so. Windows does not. That's true, but the only difference is that CR-LF is mapped to CR in text mode input and the other way around in text mode output, and ^Z is treated as EOF in