***********************
** FILE NAME : string.cpp
** SYSTEM NAME : Andromeda X-Windows Encapsulation
-** VERSION NUMBER : $Revision: 1.1 $
+** VERSION NUMBER : $Revision: 1.2 $
**
** DESCRIPTION : String class implementation.
**
/*****************************
$Log: string.cpp,v $
- Revision 1.1 2002-07-25 08:01:27 arjen
+ Revision 1.2 2002-09-28 06:42:11 arjen
+ A few small bug fixes.
+
+ Revision 1.1 2002/07/25 08:01:27 arjen
First checkin, AXE release 0.2
*****************************/
-static const char RCSID[] = "$Id: string.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $";
+static const char RCSID[] = "$Id: string.cpp,v 1.2 2002-09-28 06:42:11 arjen Exp $";
#include <stdio.h>
#include <ctype.h>
/* Input and output */
-ostream& operator<<(ostream& s, const String& x)
+std::ostream& operator<<(std::ostream& s, const String& x)
{
if (x.p->s)
s << x.p->s;
return s;
}
-istream& operator>>(istream& s, String& x)
+std::istream& operator>>(std::istream& s, String& x)
{
char buf[1024];
int i;
i++;
s.get(buf[i]);
}
- while (buf[i] != '\n');
- buf[i] = '\0';
+ while (s && buf[i] != '\n');
+ if (buf[i] == '\n')
+ {
+ buf[i] = '\0';
+ }
x = buf;
return s;
}