🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.hp.hpux
Article #35

Re: HP-UX 10.01 C++ : Bug in fstream Library ?

#35
From: Ronald Schmitz
Date: Thu, 15 Feb 1996 06:05
94 lines
2596 bytes
In article <4ei4hd$6ov@news.Austria.EU.net>, paumann@apars1.apa.co.at says...
>
>Hi !
>
>Have someone recognized a problem
>with files in input and output mode
>when reading to the end of the file
>and then want to write something to
>the file ?
>
>Try the following (command line) with the
>Example (see end of posting) compiled to a.out :
>
>$ echo test >dingsda
>$ a.out
>$ wc -l dingsda
>$ cat dingsda
>
>ok. dingsda got 40 lines with the same string
>in it ("1234567890_12\n").
>But then try this.
>
>$ rm dingsda
>$ a.out
>$ wc -l dingsda
>$ cat dingsda
>
>you will get _one line_ with the above string
>in it !?!?
>
>When shortening the above string with one
>character to "1234567890_1\n" both command
>line examples above will work like expected 
>(40 lines are generated) !
>
>
>Someone ever hit this bug ?
>Maybe there is a patch ?
>Please help !
>
>Thanx, mario
>
>
>
>a.out source :
>--------------
>
>#include <iostream.h>
>
>main()
>
>{ fstream mylog;
>  char i[1024];
>
>  mylog.open("dingsda", ios::in | ios::out);
>
>  // Reading
>  mylog >> i;
>
>  // Writing
>  // !!!!! Take care about the length of the string !!!!!!
>  for (int j=0; j<40; j++)
>    mylog << "1234567890_12\n;
>
>  return 0;
>}
>
>--------------------------------------
>Fuer de.comp.lang.c++ Zuschauer :
>Tut mir leid, dass ich englisch geschrieben
>habe, aber ich wollte es auch in englische
>newsgroups posten. Danke !

I've experienced a similar type problem simply opening a file and writing 
something to it---in fact, it shows up as a link error.  For example,

#include <iostream.h>
#include <fstream.h>

main()
{
  ofstream( "test.out");
  cout << "Hello World\n";

  return 0;
}

This causes a link error which implies that there are no overloaded operators 
"<<" defined for ofstream for type const char*.  I'm using the GNU C++ 
compiler on a HP-UX 10. system. But if I use the standard C approach using 
"fopen(...", it works fine. I'd appreciate any useful information in 
straightening this out.

John B.
Technical Details
Message-ID: <4fuien$7ds@news.ro.com>
Path: arc1-ca.pugleaf.net!news.ro.com!usenet
References: <4ei4hd$6ov@news.Austria.EU.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.ro.com!usenet
From: prac@ro.com (Ronald Schmitz)
Newsgroups: comp.sys.hp.hpux,comp.lang.c++,de.comp.lang.c++
Subject: Re: HP-UX 10.01 C++ : Bug in fstream Library ?
Date: 15 Feb 1996 06:05:11 GMT
Organization: RENAISSANCE INTERNET SERVICES
Message-ID: <4fuien$7ds@news.ro.com>
References: <4ei4hd$6ov@news.Austria.EU.net>
Reply-To: prac@ro.com
NNTP-Posting-Host: ts2p15.ro.com
Mime-Version: 1.0
Content-Type: Text/Plain; charset=ISO-8859-1
X-Newsreader: WinVN 0.99.5