/*
* =====================================================================================
*
* Filename: cmp_str.c
*
* Description: jjjj
*
* Version: 1.0
* Created: 2013年02月26日 10时52分58秒
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include
#include
#define STRING_SIZE 1024
static char gbuf [ STRING_SIZE ];
static char gOne_line_string [ STRING_SIZE ];
int main(int argc, const char *argv[])
{
FILE *fd_argv1;
FILE *fd_argv2;
FILE *fd_out;
int string_len;
char *buf;
fd_argv1 = fopen( argv[1], "r" );
fd_argv2 = fopen( argv[2], "r" );
remove( "./out" );
fd_out = fopen( "./out", "w+" );
while( fgets( gOne_line_string, STRING_SIZE, fd_argv1 ) )
{
/*printf( "argv[1] %s\n", gOne_line_string );*/
string_len = strlen( gOne_line_string );
fseek( fd_argv2, SEEK_SET, SEEK_SET );
while( 1 )
{
buf = fgets( gbuf, STRING_SIZE, fd_argv2 );
/*printf( "argv[2] %s\n", gbuf );*/
if( 0 == strncmp( gOne_line_string, gbuf, strlen - 2 ) )
{
break;
}
if( NULL == buf )
{
/*printf( "XXXXXXXXXXXXXXXXXXXXXX %s", gOne_line_string);*/
fputs( gOne_line_string, fd_out );
break;
}
}
}
puts("");
return 0;
}
阅读(1106) | 评论(0) | 转发(0) |