Re: Help - I'm at wit's end...

From: BRG (brg_at_nowhere.org)
Date: 12/30/04


Date: Wed, 29 Dec 2004 23:18:59 +0000

Mike Scott wrote:

[snip]
>>>That was my next thought. However, if there's anything that has any
>>>chance to swap newlines for carriage returns, I can't find it. Add in
>>>the fact that this "inversion" *DOES NOT* happen when the exact same
>>>code (just called by a different mainline routine that gets its data
>>>from the FIPS test files rather than a ".torrent" file or its target))
>>>is handed the FIPS test vectors - when using the FIPS vectors, I get
>>>exactly the expected results - and I come up with "That's probably not
>>>it either".
>>
>>However in some OS's (e.g Windows) the main routine may need to be
>>different (or simply be different) for the two sorts of files since the
>>FIPS vectors are probably in a text file, for which fopen(filename, "r")
>>would need to be used to open the file, whereas the bit torrent file
>>would possibly be binary, which would require fopen(filename, "rb") in
>>order to read a binary file without special handling of the line ending
>>characters (I am assuming C code here).
>
> Actually its best to explicitly use "rt" or "rb" (t for text, b for binary).
> Use of "r" on its own is ambiguous - and the results depend on the compiler
> defaults. Most interpret "r" as "rt", but I am aware of at least one C
> compiler which interprets "r" as "rb".

Interesting - I was not aware that a 't' option existed - is this an
ANSI designated file opening mode?

Is it widely recognised (or silently ignored where it is unecessary)?

    Brian Gladman



Relevant Pages

  • Re: Aqua is a Plastic Cube!
    ... if WPF were put into Apple's old Mac OS X ... the problem this platform has is that it's rather vaguely defined, ... better than it is on X Windows or Windows XP. ...
    (comp.sys.mac.advocacy)
  • Re: Great SWT Program
    ... using computers was with Windows. ... Moving the cursor can be done in a number of ways (arrow keys plus ... But vim does. ...
    (comp.lang.java.programmer)
  • Re: Drag it to the trash...
    ... Seems to have worked for everyone that uses VMS anyways. ... He finds *lots* of bugs in Windows. ... is NTFS, but you might chose to use VFAT (say, for Mac OS X ...
    (comp.sys.mac.advocacy)
  • Re: Drag it to the trash...
    ... VMS was a minicomputer OS, and was aimed at much more ... DOS batch files are at least much simpler than DCL. ... He finds *lots* of bugs in Windows. ...
    (comp.sys.mac.advocacy)
  • Re: Windows.. its like coming home!
    ... PowerBook G4, ... I don't need a Mac to run Windows. ... I'd ask if the MacBook is zippy, ...
    (comp.sys.mac.advocacy)