First commit 07/04/1999
This commit is contained in:
32
snr.cpp
Normal file
32
snr.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma hdrstop
|
||||
#include <condefs.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma argsused
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char string[500], *ptr;
|
||||
int lengSRC;
|
||||
|
||||
if ( argc < 3 )
|
||||
{
|
||||
puts( "Search'n'Replace v1.0 | Jos<6F> David Guill<6C>n\n" );
|
||||
puts( "snr [search] [replace]\n" );
|
||||
} else {
|
||||
lengSRC = strlen( argv[1] );
|
||||
while ( gets( string ) != NULL )
|
||||
{
|
||||
if ( ( ptr = strstr( string, argv[1] ) ) == NULL )
|
||||
{
|
||||
puts( string );
|
||||
} else {
|
||||
ptr[0] = '\0';
|
||||
printf("%s%s%s\n", string, argv[2], ptr + lengSRC );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user