다음은 스티븐아저씨책에 나온 소스인데요.
dst(타겟)측에 먼저 " "(blank)를 1byte 써주는 이유가 뭔지 모르겠습니
다.
#include
#include
#include
#include
#include
#define MAP_FILE 0
int main( int argc , char *argv[] )
{
int fdin , fdout;
char *src , *dst;
struct stat statbuf;
if ( argc != 3 )
exit( 2 );
if ( ( fdin = open( argv[1] , O_RDONLY ) ) < 0 )
fprintf( stderr , "open src error\n" );
if ( ( fdout = open( argv[2] , O_RDWR | O_CREAT | O_TRUNC , 0 ) )