Alex Vinokur wrote:
> char cbuffer[BUFFER_SIZE];
> ifstream fs (INPUT_FILE_NAME);
> 
>   fs.clear();
>   fs.seekg (0, ios::beg);
> 
>   while (!fs.eof())
>   {
>     fs.read (cbuffer, sizeof(cbuffer));
>     cout << "rdstate() = 0x" << hex << fs.rdstate() << dec << "; gcount()
= " << fs.gcount() << endl;
>   }

[...]
> Output for g++ (Cygwin)
> --------------------
> rdstate() = 0x6; gcount() = 1499
> rdstate() = 0x6
> -------------------
> It seems that behavior of g++ is wrong here.

There are several stupid things in the code you gave, I won't go into
those. Now, while opening the file, you request that external CR/LF pairs
be converted to an internal '\n'. However, in your file there are LFs that
are not preceeded by CRs, so in fact your file is invalid. At least I
wouldn't be too sure about this being an error, I think Cygwin itself can
also be configured whether its lineendings behaviour should match that of
DOS or of Unix. Disclaimer: I'd have to trace the code myself to see
what's wrong, but take these things into account.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to