🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.hp.hpux
2 messages
2 total messages Started by Mario Paumann Mon, 29 Jan 1996 15:39
HP-UX 10.01 C++ : Bug in fstream Library ?
#34
Author: Mario Paumann
Date: Mon, 29 Jan 1996 15:39
70 lines
1732 bytes
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 !
Re: HP-UX 10.01 C++ : Bug in fstream Library ?
#35
Author: 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads