public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "elizbus at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/40732]  New: fstream get/put pointers have unexpected positions
Date: Mon, 13 Jul 2009 14:23:00 -0000	[thread overview]
Message-ID: <bug-40732-17936@http.gcc.gnu.org/bugzilla/> (raw)

My understanding is that with fstream, get and put pointers move together.  
Therefore expect output of following to be aabbc1234, output is actually aabbc.
This had expected result with 3.3.1, unexpected result with 3.4.4.


#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
fstream myStream;
myStream.open("myTestFile.out", ios_base::in | ios_base::out | ios::trunc);
// write "aabbc" to file
myStream.put('a');
myStream.put('a');
myStream << "b";
myStream << "b";
myStream << "c";
//rewind
myStream.seekg(0);
char c;
//skip over data
for (int i=0; i < 5; i++) {
myStream.get(c);
}
// append 1234 to file
myStream << "1234\n";
myStream.close();
return 0;
}


Configured with: ./configure --prefix=/usr/local/gcc-3.4.4
Thread model: posix
gcc version 3.4.4


-- 
           Summary: fstream get/put pointers have unexpected positions
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: elizbus at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40732


             reply	other threads:[~2009-07-13 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 14:23 elizbus at yahoo dot com [this message]
2009-07-13 14:34 ` [Bug libstdc++/40732] " paolo dot carlini at oracle dot com
2009-07-13 17:24 ` elizbus at yahoo dot com
2009-07-13 19:59 ` paolo dot carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40732-17936@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).