-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTEXTEDIT.C
132 lines (128 loc) · 1.73 KB
/
TEXTEDIT.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include<stdio.h>
#include<conio.h>
#include<dos.h>
int getkey(void);
void layout(void);
void main()
{
char ch1;
int cho,i,j;
FILE *usr;
layout();
input();
clrscr();
clrscr();
system("cls");
system("cls");
}
int input(char *start)
{
int choice1,y=2,ct=0;
char choice,prev;
FILE *temp;
temp=fopen("temp.txt","ab+");
if(temp==NULL)
{
printf("FATAL ERROR CANNOT OPEN THE FILE....contact your programe vendor");
clrscr();
system("cls");
exit(2);
}
gotoxy(2,2);
y++;
while(1)
{
while(choice1!=27)
{
fflush(stdin);
textbackground(GREEN);
textcolor(WHITE);
choice=getch();
prev=choice;
choice1=choice;
ct++;
if(choice1==8)
{
textbackground(GREEN);
printf("\b");
cprintf(" ");
printf("\b");
textcolor(WHITE);
ct--;
rewind(temp);
fputc(NULL,temp);
continue;
}
if(choice!=NULL && choice1!=27)
{
cprintf("%c",choice);
putc(choice,temp);
}
if(choice==NULL)
getch();
if(choice1==13 || ct==76)
{
gotoxy(2,y++);
ct=0;
}
}
break;
}
putc(EOF,temp);
close(temp);
return(0);
}
void layout(void)
{
int i;
window(1,1,80,25);
textbackground(LIGHTGREEN);
textcolor(BLACK);
gotoxy(1,1);
cprintf(".");
clrscr();
window(1,1,80,25);
gotoxy(1,2);
printf("%c",201);
gotoxy(1,25);
printf("%c",200);
gotoxy(80,2);
printf("%c",187);
gotoxy(80,25);
printf("%c",188);
for(i=2;i<80;i++)
{
gotoxy(i,1);
printf("%c",205);
}
for(i=2;i<80;i++)
{
gotoxy(i,24);
printf("%c",205);
}
for(i=2;i<24;i++)
{
gotoxy(1,i);
printf("%c",186);
gotoxy(80,i);
printf("%c",186);
}
textbackground(LIGHTGRAY);
for(i=2;i<80;i++)
{
gotoxy(i,25);
cprintf(" ");
}
textcolor(RED);
gotoxy(3,25);
cprintf("FILE");
}
/*int getkey(void)
{
union REGS i,o;
while(kbhit())
{
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}*/