#946 ofstream::write places linefeed after carriage return

Known_Feature
closed-invalid
nobody
gcc (462)
2006-07-01
2006-05-27
No

It would seem that the implementation of
ofstream::write feeds a line feed following a carriage
return. My suspicion is that operator<< code was used
to implement this method. That is counter to the
standard and can make for problems that are very
difficult to detect. This glitch makes writing binary
files using ofstream impossible.

Discussion

  • Earnie Boyd

    Earnie Boyd - 2006-05-30
    • labels: 104601 --> gcc
     
  • Luke Dunstan

    Luke Dunstan - 2006-05-31

    Logged In: YES
    user_id=30442

    Did you mean to say that it writes a carriage return+line
    feed if you tell it to output a line feed? Did you open
    the file in binary mode? If not this is normal.

     
  • Nick Apperson

    Nick Apperson - 2006-05-31

    Logged In: YES
    user_id=1529584

    I was under the mistaken impression that write() always
    wrote data as binary, but after further review of the
    standard, I am now unclear on this. I will take your word
    for it. I still haven't found anywhere that unambiguously
    states one way or another about write, but I am sure I will
    find it soon enough. Thanks for the response. Sorry for
    wasting your time.

     
  • Earnie Boyd

    Earnie Boyd - 2006-05-31

    Logged In: YES
    user_id=15438

    So, to counteract you can add /mingw/lib/binmode.o to your
    link step to force the binary mode file handles. For more
    information on this google for "binary vs text mode" without
    the quotes and also "binary vs text mode _fmode".

     
  • Earnie Boyd

    Earnie Boyd - 2006-05-31
    • milestone: --> Known_Feature
    • status: open --> pending-invalid
     
  • SourceForge Robot

    • status: pending-invalid --> closed-invalid
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 30 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks