/* win2unix */
#include
#include "stdlib.h"
#include "conio.h"
#include "string.h"
int
#include
main
(argv
, args
[]){char * int FILE
fp1
,fp2
;**
charc
;
chars
[100];
ifargv
<2){( printf
("Usage: win2unix input-file-name [output-file-name]");
return 1;
}
iffp1
=fopen
(args
[NULL
){1],"rb"))==(( printf
(args
[1]);"Error: Fail to open %s.",
return 1;
}
ifargv
==2){(
sprintf
(s
,args
[1]);"u_%s",
}
else{
sprintf
(s
,args
[2]);"%s",
strcmp
(s
,args
[1])==0){if(
printf
("Error: Output file name must not be same to that of the input file.");
fclose
(fp1
);
return 1;
}
} fp2
=fopen
(s
,"wb");
while(1){ c
=fgetc
(fp1
);
iffeof
(fp1
)!=0){(
break;
}
ifc
!='/r'){(
fputc
(c
,fp2
);
}
} fclose
(fp1
); fclose
(fp2
);
return 0;
"stdio.h"#include "stdlib.h"
#include "conio.h"
#include "string.h"
int
}
附:如果在Unix下,只消几行语句就可以解决问题:
#!/bin/sh
tr -d '/015' < "$1" >temp.$$
mv temp.$$ "$1"
tr -d '/015' < "$1" >temp.$$
mv temp.$$ "$1"