Article View: gnu.g++.lib.bug
Article #398Bugs with libg++-2.2
From: Bruce Scanlan
Date: Wed, 16 Dec 1992 07:48
Date: Wed, 16 Dec 1992 07:48
100 lines
3301 bytes
3301 bytes
Good Day
I installed libg++2.2.tar.Z on my decstation 5000, running Ultrix.
gcc-2.3.2 has been installed on this machine as well.
I ran configure using a host of "mips-dec-ultrix". I received some
warnings regarding implicit casts to void* and had to modify some
files correct this. The problem I am now working on is in a file
tFile.C in the libg++-2.2/libg++/iostream/test directory.
In function void t4(), line 129 of tFile.C there is the following
function void t4(). As noted the two lines (144 and 172 of tFile.C )
has to be modified in this manner to work.
If this problem has been noted, would you please send me instructions
as to where to get the patch.
void t4()
{
char s[100];
char ch;
int i;
cout << "\nMaking File tf ... ";
#ifdef _OLD_STREAMS
File tf("tempfile", io_readwrite, a_create);
#else
fstream tf("tempfile", ios::in|ios::out|ios::trunc);
#endif
assert(tf.good());
assert(tf.is_open());
assert(tf.writable());
assert(tf.readable());
strcpy(s, "This is the first and only line of this file.\n");
#ifdef _OLD_STREAMS
tf.put(s);
tf.seek(0);
#else
tf << s; <----------------------------requires tf to be cast to (ostream&)
tf.rdbuf()->seekoff(0, ios::beg);
#endif
tf.get(s, 100);
assert(tf.good());
cout << "first line of file:\n" << s << "\n";
cout << "next char = ";
cout << "next char = ";
tf.get(ch);
cout << (int)ch;
cout.put('\n');
assert(ch == 10);
strcpy(s, "Now there is a second line.\n");
cout << "reopening tempfile, appending: " << s;
#ifdef _OLD_STREAMS
tf.open(tf.name(), io_appendonly, a_use);
#else
tf.close();
tf.open("tempfile", ios::app);
#endif
assert(tf.good());
assert(tf.is_open());
assert(tf.writable());
assert(!tf.readable());
#ifdef _OLD_STREAMS
tf.put(s);
assert(tf.good());
tf.open(tf.name(), io_readonly, a_use);
#else
tf << s; <----------------------------requires tf to be cast to (ostream&)
assert(tf.good());
tf.close();
tf.open("tempfile", ios::in);
#endif
tf.raw();
assert(tf.good());
assert(tf.is_open());
assert(!tf.writable());
assert(tf.readable());
cout << "First 10 chars via raw system read after reopen for input:\n";
read(tf.filedesc(), s, 10);
assert(tf.good());
for (i = 0; i < 10; ++ i)
cout.put(s[i]);
lseek(tf.filedesc(), 5, 0);
cout << "\nContents after raw lseek to pos 5:\n";
while ( (tf.get(ch)) && (cout.put(ch)) );
#ifdef _OLD_STREAMS
tf.remove();
#else
tf.close();
unlink("tempfile");
#endif
assert(!tf.is_open());
}
--
--------------------------------------------------------------------------
Bruce Scanlan | Promis Systems Corp ph# 416 960 0960 x237
scanlan%promis@snitor.sni.ca | Toronto, Ontario fax 416 960 1222
scanlan@gpu.utcs.utoronto.ca | Canada
Technical Details
Message-ID:
<9212161749.AA13211@argon.dev.promis.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!promis.UUCP!scanlanShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!promis.UUCP!scanlan From: scanlan@promis.UUCP (Bruce Scanlan) Subject: Bugs with libg++-2.2 Message-ID: <9212161749.AA13211@argon.dev.promis.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 16 Dec 1992 07:48:59 GMT Approved: bug-lib-g++@prep.ai.mit.edu Lines: 101