Files in the Windows format to Unix format
/ * Win2Unix * / # include "stdio.h" #include "stdlib.h" #include "conoe.h" #include "string.h" int main (int Argv, char * args []) {file * fp1, * fp2; char C; char S [100]; if ("USAGV <2) {Printf (" Usage: Win2Unix Input-file-name [output-file-name] "); return 1;} IF ((fp1 = fopen) (Args [1], "RB"))) == NULL) {Printf ("Error: Fail to open% s.", args [1]); return 1;} if (argv == 2) {Sprintf (s , "u_% s", args [1]);} else {sprintf (s, "% s", args [2]); if (strcmp (s, args [1]) == 0) {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 ); If (fp1)! = 0) {Break;} if (c! = '/ R') {FPUTC (C, FP2);}} fclose (fp1); fclose (fp2); Return 0;
}
Attachment: If you are under Unix, you can solve the problem with a few line statements:
#! / bin / shtr -d '/ 015' <"$ 1"> Temp. $$ MV Temp. $$ "$ 1"