This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/5502: wrong output



>Number:         5502
>Category:       c++
>Synopsis:       wrong output
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 26 15:16:03 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     RoLo
>Release:        3.0.2
>Organization:
>Environment:
Red Hat 7.2 
kernel 2.4.18-pre3
AMD Athlon XP 1700+
128 DDR
Motherboard Soyo Dragon +
>Description:
I open a file to write, read and write again.
when the program finish I check the files I created and the out put is not what its suppose to be.
only the first write works!
I compiled the same program with g++ 2.96 and I got the out put I wanted. so I think this could be some kind of bug.
in the How-To-Repeat seccion I included an example code.
it creates a file named infile.txt but if I compile it with g++3 I get a wrong output in the file.
>How-To-Repeat:
#include <fstream>
#include <iostream>
int main(void)
{
  char a;
  std::fstream ipo("infile.txt", std::ios::ate |  std::ios::out);
  if (!ipo)
    { 
      std::cout << "File does not exist.";
      return -1;
    }
  ipo.put('.');
  a = ipo.get();
  ipo.put('A');
  ipo.close();
  return 1;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]