Re: unbuffered file IO?



MikeJ <vettes_n_jets@xxxxxxxxxxxxx> wrote:
the top section i typed fast..sorry...but
the bottome section is the class..and it compiles just fine

I dare say it *compiles* fine, but it doesn't look exactly general
purpose to me. ~ as a line ending means a line length of 106?

You've also got a bug (in at least two places) where you allocate a
buffer, read into it, and then convert the *whole* buffer into a
string, which assumes that the buffer will be filled completely.

I'm sorry to say this, but I just wouldn't trust this code without
picking it apart in detail - and I'd advise the OP to write from
scratch rather than trying to understand what this code does and fix
its issues.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Unexpected Result
    ... > and helped me to learn whilst developing my yacht race classes. ... Everything compiles without fault; however, ... > output file the results were the same. ... > like a buffer that flushes the initial input upon saturation. ...
    (comp.lang.cpp)
  • Re: Attention Windows Users
    ... knowledge of buffer overrun exploits then. ... convenient way to exploit a buffer overrun. ... > compiles to assembly. ... Just as there are plenty of compiled BASICs, ...
    (rec.aviation.piloting)
  • Re: CREATE
    ... So, in effect, 5 CONSTANT FIVE compiles the equivalent of: ... Yours requires the extra space for the calls to LIT and EXIT. ... Most implementations have only the head, code address, and the data space. ... VARIABLE BUFFER 8 ALLOT \ 10 element array called BUFFER. ...
    (comp.lang.forth)
  • Re: Sorted Linked List
    ... > I debugged the program and it compiles fine. ... to your linked list system. ... They will be placed into a buffer until you press Enter. ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.cpp)
  • Re: App wont exit correctly
    ... It's purpose is to ... I'd appreciate an explanation ... Bit of mystery. ... compiles and runs correctly on my compiler. ...
    (comp.lang.cpp)