Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Jason Venner
Wed, 22 Feb 1989 07:24
gsub problems with libg++ 1.32
Author: Jason Venner
Date: Wed, 22 Feb 1989 07:24
Date: Wed, 22 Feb 1989 07:24
44 lines
1480 bytes
1480 bytes
Given the input 'Hello There' the following program core dumps when
printing out the damaged String tester.
#include <stdio.h>
#include <stream.h>
#include <String.h>
main( int argc, char** argv )
{
char buf[2*1024];
Regex angle("<[^ \t>]+>");
Regex Re("[ \t]+$");
Regex White( "[ \t]+" );
String result;
while( gets(buf) ){
String tester( buf );
printf( "tester is '%s'\n", (char*) tester );
if( tester.contains(White)>=0 ) {
printf( "Match for '%s'\n", (char*) "WHITE" );
tester.gsub(White, "W");
printf( "'%s' -> '%s'\n", buf, (char*) tester );
cout << tester << '\n';
}
tester = buf;
if( tester.contains(angle)>=0 ) {
printf( "Match for '%s'\n", (char*) "ANGLE" );
tester.gsub(angle, "X");
printf( "'%s' -> '%s'\n", buf, (char*) tester );
cout << tester << '\n';
}
tester = buf;
if( tester.contains(Re)>=0 ) {
printf( "Match for '%s'\n", (char*) "END" );
tester.gsub(Re, "E" );
printf( "'%s' -> '%s'\n", buf, (char*) tester );
cout << tester << '\n';
}
}
exit( 0 );
}
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