-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHANGE.C
executable file
·54 lines (48 loc) · 1.02 KB
/
CHANGE.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <def.c>
#include <stdio.h>
FILE *f,*f2;
char zeichen, fname[67];
void convert()
{
printf("\nKonvertiere \"%s\"...",fname);
while(!feof(f))
{
zeichen=fgetc(f);
if(zeichen==0xfc) zeichen='”';
if(zeichen==0xe4) zeichen='„';
if(zeichen==0xf6) zeichen='';
if(zeichen==0xdf) zeichen='á';
fputc(zeichen,f2);
}
printf("fertig!\n");
}
void files()
{
fclose(f); fclose(f2);
/*
remove(fname);
rename("change.tmp",fname);
*/
}
main(int argc, char *argv[])
{
_clearscreen(0);
argc--;
if (argc!=1)
{
printf("\nCHANGER: Parameter nicht korrekt!\n");
exit(1);
} else strcpy(fname,argv[1]);
if((f2=fopen("change.tmp","w"))==NULL)
{
printf("\nCHANGER: Konnte Datei \"CHANGE.TMP\" nicht ”ffnen!\n");
exit(1);
}
if((f=fopen(fname,"r"))==NULL)
{
printf("\nCHANGER: Konnte Datei \"%s\" nicht ”ffnen!\n",fname);
exit(1);
} else convert();
files();
printf("\nDatei \"%s\" fertig konvertiert!\n",fname);
}