SlideShare a Scribd company logo
2
Most read
9
Most read
11
Most read
WAP A C PROGRAM TO CREATE TEXT EDITOR WHICH CONTAIN
THE WORKING OF OPEN, SAVE, NEW, EXIT AND RENAME
Term paper submitted
By
To
Department of Computer
Science and Engineering
In partial fulfilment of the Requirement for
the CA of Linux Programming
To
Mr. Sir
(December 2013)
CONTENTS
 INTRODUCTION TO TEXT EDITORS
 AKNOWLEDGEMENT
 ALGORITHM
 SOURCE CODE
 OUTPUT
 CONCLUSION
 REFERENCES
INTRODUCTION TO TEXT EDITORS
A text editor is used to edit plain text files. Text editors differ from word processors, such as
Microsoft Word or WordPerfect, in that they do not add additional formatting information to
documents. You might write a paper in Word, because it contains tools to change fonts, margins,
and layout, but Word by default puts that formatting and layout information directly into the file,
which will confuse the compiler. If you open a .doc file in a text editor, you will notice that most
of the file is formatting codes. Text editors, however, do not add formatting codes, which makes
it easier to compile your code.
Text editors have a feature set different from that of a traditional word processing program. For
example, most won't let you include pictures, or include tables, or double-space your
writing. The features of text editors vary from implementation to implementation, but there are
several kinds of features that most editors have. Below are listed some of the most common and
useful features.
ACKNOWLEDGEMENT
The satisfaction that accompanies the successful completion of any task would be incomplete
without the mention of people whose ceaseless cooperation made it possible, whose constant
guidance and encouragement crown all efforts with success. I am extremely grateful to my
teacher ‘Mr.Sir’ for being a source of inspiration and for her constant support in the design,
implementation and evaluation of this term paper. I am thankful to him for his constant
constructive criticism and valuable suggestions, which benefited me a lot while developing the
term paper on ‘Text Editors’. Through this column, it would be my utmost pleasure to express
my warm thanks to him for his encouragement, co-operation and consent as without which I
mightn’t be able to accomplish this term paper.
I would also like to express my thanks to almighty god for his grace and mercy.
Above all, I am extremely thankful to my friends who always remained aside me.
ALGORITHM:
1. Display options new, open and exit and get choice.
2. If choice is 1 , call Create() function.
3. If choice is 2, call Display() function.
4. If choice is 3, call Append() function.
5. If choice is 4, call Delete() function.
6. If choice is 5, call Display() function.
7. Create()
7.1 Get the file name and open it in write mode.
7.2 Get the text from the user to write it.
8. Display()
8.1 Get the file name from user.
8.2 Check whether the file is present or not.
8.2 If present then display the contents of the file.
9. Append()
9.1 Get the file name from user.
9.2 Check whether the file is present or not.
9.3 If present then append the file by getting the text to add with the existing file.
10. Delete()
10.1 Get the file name from user.
10.2 Check whether the file is present or not.
10.3 If present then delete the existing file.
WAP A C PROGRAM TO CREATE TEXT EDITOR WHICH CONTAIN
THE WORKING OF OPEN, SAVE, NEW, EXIT AND RENAME
1 #include<stdio.h>
2 #include<conio.h>
3 #include<process.h>
4 int i,j,ec,fg,ec2;
5 char fn[20],e,c;
6 FILE *fp1,*fp2,*fp;
7 void Create();
8 void Append();
9 void Delete();
10 void Display();
11 void main()
12 {
13 do {
14 printf("ntt***** TEXT EDITOR *****");
15 printf("nntMENU:nt-----n ");
16 printf("nt1.CREATEnt2.DISPLAYnt3.APPENDnt4.DELETEnt5.EXITn");
17 printf("ntEnter your choice: ");
18 scanf("%d",&ec);
19 switch(ec)
20 {
a) case 1:
b) Create();
c) break;
d) case 2:
e) Display();
f) break;
g) case 3:
h) Append();
i) break;
j) case 4:
k) Delete();
l) break;
m) case 5:
n) exit(0);
21 }
22 }while(1);
23 }
24 void Create()
25 {
26 fp1=fopen("temp.txt","w");
27 printf("ntEnter the text and press '.' to savennt");
28 while(1)
29 {
30 c=getchar();
31 fputc(c,fp1);
32 if(c == '.')
33 {
a) fclose(fp1);
b) printf("ntEnter then new filename: ");
c) scanf("%s",fn);
d) fp1=fopen("temp.txt","r");
e) fp2=fopen(fn,"w");
f) while(!feof(fp1))
g) {
h) c=getc(fp1);
i) putc(c,fp2);
j) }
k) fclose(fp2);
l) break;
34 }}
35 }
36 void Display()
37 {
38 printf("ntEnter the file name: ");
39 scanf("%s",fn);
40 fp1=fopen(fn,"r");
41 if(fp1==NULL)
42 {
a) printf("ntFile not found!");
b) goto end1;
43 }
44 while(!feof(fp1))
45 {
a) c=getc(fp1);
b) printf("%c",c);
46 }
47 end1:
48 fclose(fp1);
49 printf("nntPress any key to continue...");
50 getch();
51 }
52 void Delete()
53 {
54 printf("ntEnter the file name: ");
55 scanf("%s",fn);
56 fp1=fopen(fn,"r");
57 if(fp1==NULL)
58 {
a) printf("ntFile not found!");
b) goto end2;
59 }
60 fclose(fp1);
61 if(remove(fn)==0)
62 {
a) printf("nntFile has been deleted successfully!");
b) goto end2;
63 }
64 else
a) printf("ntError!n");
65 end2: printf("nntPress any key to continue...");
66 getch();
67 }
68 void Append()
69 {
70 printf("ntEnter the file name: ");
71 scanf("%s",fn);
72 fp1=fopen(fn,"r");
73 if(fp1==NULL)
74 {
a) printf("ntFile not found!");
b) goto end3;
75 }
76 while(!feof(fp1))
77 {
a) c=getc(fp1);
b) printf("%c",c);
78 }
79 fclose(fp1);
80 printf("ntType the text and press 'Ctrl+S' to append.n");
81 fp1=fopen(fn,"a");
82 while(1)
83 {
a) c=getch();
b) if(c==19)
c) goto end3;
d) if(c==13)
e) {
f) c='n';
g) printf("nt");
h) fputc(c,fp1);
i) }
j) else
k) {
l) printf("%c",c);
m) fputc(c,fp1);
n) }
84 }
85 end3: fclose(fp1);
86 getch();
87 }
OUTPUT :-
Text editors project
CONCLUSION
Here, I conclude my lines of my term paper on the topic ‘Text Editors’ with the extreme
satisfaction and contentment. This term paper contains brief definition of Text Editor together
with its features and functions.
Added to this, my term paper contains the basic description to Create, Edit, Save,
Delete and Exit from file through C program. It also includes practical implementation of text
editors through complex c program which is created by our group. Also I have sincerely included
the references from where I have made my term paper. This term paper is the outcome of my
hard and laborious work and contains a complete knowledge on the path independent line
integral.
Here, I end my lines with the hope that my term paper will be equally appreciated and
heartily accepted by all. Also, all my faults and mistakes would be forgiven.
REFERENCES :-
 www.cprogramming.com/texteditors.html
 http://en.wikipedia.org/wiki/Text_editor
 http://whatis.techtarget.com/definition/text-editor

More Related Content

What's hot (20)

PPT
javaScript.ppt
sentayehu
 
PPTX
Validation Controls in asp.net
Deep Patel
 
PPTX
Introduction to java
Veerabadra Badra
 
PPTX
Scope rules : local and global variables
sangrampatil81
 
PPTX
Basics of JAVA programming
Elizabeth Thomas
 
PPTX
Unit 4 sp macro
Deepmala Sharma
 
PPTX
Inheritance in JAVA PPT
Pooja Jaiswal
 
PPTX
Html5 tutorial for beginners
Singsys Pte Ltd
 
PPTX
Programming in C Presentation upto FILE
Dipta Saha
 
PPT
Introduction To Dotnet
SAMIR BHOGAYTA
 
PPTX
oops concept in java | object oriented programming in java
CPD INDIA
 
ODP
History of JavaScript
Rajat Saxena
 
PPT
Php forms
Anne Lee
 
PPT
Scripting languages
teach4uin
 
PPT
Visual Studio IDE
Sayantan Sur
 
PPTX
Steps for c program execution
Rumman Ansari
 
PPTX
introduction to visual basic PPT.pptx
classall
 
PPTX
data types in C programming
Harshita Yadav
 
PPT
JavaScript Tutorial
Bui Kiet
 
PPTX
HTTP request and response
Sahil Agarwal
 
javaScript.ppt
sentayehu
 
Validation Controls in asp.net
Deep Patel
 
Introduction to java
Veerabadra Badra
 
Scope rules : local and global variables
sangrampatil81
 
Basics of JAVA programming
Elizabeth Thomas
 
Unit 4 sp macro
Deepmala Sharma
 
Inheritance in JAVA PPT
Pooja Jaiswal
 
Html5 tutorial for beginners
Singsys Pte Ltd
 
Programming in C Presentation upto FILE
Dipta Saha
 
Introduction To Dotnet
SAMIR BHOGAYTA
 
oops concept in java | object oriented programming in java
CPD INDIA
 
History of JavaScript
Rajat Saxena
 
Php forms
Anne Lee
 
Scripting languages
teach4uin
 
Visual Studio IDE
Sayantan Sur
 
Steps for c program execution
Rumman Ansari
 
introduction to visual basic PPT.pptx
classall
 
data types in C programming
Harshita Yadav
 
JavaScript Tutorial
Bui Kiet
 
HTTP request and response
Sahil Agarwal
 

Similar to Text editors project (20)

DOCX
Design problem
Sanjay Kumar Chakravarti
 
DOCX
Problem 1- Text Editor using files and strings using C++ In this proje.docx
rtodd884
 
PDF
The Task For this assignment you will write a rudimentary text edi.pdf
info785431
 
PDF
IN C++ languageWrite a simple word processor that will accept text.pdf
aratextails30
 
PPTX
Unit-VI.pptx
Mehul Desai
 
PDF
Objectives 1. Understand the design, implementation, usage and limita.pdf
sivakumar19831
 
PDF
Working with files (concepts/pseudocode/python)
FerryKemperman
 
PPT
File handling in c
David Livingston J
 
PDF
VIT351 Software Development VI Unit5
YOGESH SINGH
 
PDF
Unit 5 File handling in C programming.pdf
SomyaPachauri1
 
PPT
Mesics lecture files in 'c'
eShikshak
 
PPTX
COM1407: File Processing
Hemantha Kulathilake
 
PPTX
Programming in C by SONU KUMAR.pptx
SONU KUMAR
 
PPTX
PPS PPT 2.pptx
Sandeepbhuma1
 
PPS
C programming session 11
AjayBahoriya
 
PPT
file_handling_in_c.ppt
DHARUNESHBOOPATHY
 
PPTX
Programming Fundamentals lecture-22.pptx
singyali199
 
PPS
C programming session 11
Vivek Singh
 
PPTX
Presentation of file handling in C language
Shruthi48
 
DOCX
Satz1
rajeshmhvr
 
Design problem
Sanjay Kumar Chakravarti
 
Problem 1- Text Editor using files and strings using C++ In this proje.docx
rtodd884
 
The Task For this assignment you will write a rudimentary text edi.pdf
info785431
 
IN C++ languageWrite a simple word processor that will accept text.pdf
aratextails30
 
Unit-VI.pptx
Mehul Desai
 
Objectives 1. Understand the design, implementation, usage and limita.pdf
sivakumar19831
 
Working with files (concepts/pseudocode/python)
FerryKemperman
 
File handling in c
David Livingston J
 
VIT351 Software Development VI Unit5
YOGESH SINGH
 
Unit 5 File handling in C programming.pdf
SomyaPachauri1
 
Mesics lecture files in 'c'
eShikshak
 
COM1407: File Processing
Hemantha Kulathilake
 
Programming in C by SONU KUMAR.pptx
SONU KUMAR
 
PPS PPT 2.pptx
Sandeepbhuma1
 
C programming session 11
AjayBahoriya
 
file_handling_in_c.ppt
DHARUNESHBOOPATHY
 
Programming Fundamentals lecture-22.pptx
singyali199
 
C programming session 11
Vivek Singh
 
Presentation of file handling in C language
Shruthi48
 
Satz1
rajeshmhvr
 
Ad

Recently uploaded (20)

PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PDF
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Ethics and Trustworthy AI in Healthcare – Governing Sensitive Data, Profiling...
AlqualsaDIResearchGr
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Ad

Text editors project

  • 1. WAP A C PROGRAM TO CREATE TEXT EDITOR WHICH CONTAIN THE WORKING OF OPEN, SAVE, NEW, EXIT AND RENAME Term paper submitted By To Department of Computer Science and Engineering In partial fulfilment of the Requirement for the CA of Linux Programming To Mr. Sir (December 2013) CONTENTS
  • 2.  INTRODUCTION TO TEXT EDITORS  AKNOWLEDGEMENT  ALGORITHM  SOURCE CODE  OUTPUT  CONCLUSION  REFERENCES INTRODUCTION TO TEXT EDITORS A text editor is used to edit plain text files. Text editors differ from word processors, such as Microsoft Word or WordPerfect, in that they do not add additional formatting information to
  • 3. documents. You might write a paper in Word, because it contains tools to change fonts, margins, and layout, but Word by default puts that formatting and layout information directly into the file, which will confuse the compiler. If you open a .doc file in a text editor, you will notice that most of the file is formatting codes. Text editors, however, do not add formatting codes, which makes it easier to compile your code. Text editors have a feature set different from that of a traditional word processing program. For example, most won't let you include pictures, or include tables, or double-space your writing. The features of text editors vary from implementation to implementation, but there are several kinds of features that most editors have. Below are listed some of the most common and useful features.
  • 4. ACKNOWLEDGEMENT The satisfaction that accompanies the successful completion of any task would be incomplete without the mention of people whose ceaseless cooperation made it possible, whose constant guidance and encouragement crown all efforts with success. I am extremely grateful to my teacher ‘Mr.Sir’ for being a source of inspiration and for her constant support in the design, implementation and evaluation of this term paper. I am thankful to him for his constant constructive criticism and valuable suggestions, which benefited me a lot while developing the term paper on ‘Text Editors’. Through this column, it would be my utmost pleasure to express my warm thanks to him for his encouragement, co-operation and consent as without which I mightn’t be able to accomplish this term paper. I would also like to express my thanks to almighty god for his grace and mercy. Above all, I am extremely thankful to my friends who always remained aside me.
  • 5. ALGORITHM: 1. Display options new, open and exit and get choice. 2. If choice is 1 , call Create() function. 3. If choice is 2, call Display() function. 4. If choice is 3, call Append() function. 5. If choice is 4, call Delete() function. 6. If choice is 5, call Display() function. 7. Create() 7.1 Get the file name and open it in write mode. 7.2 Get the text from the user to write it. 8. Display() 8.1 Get the file name from user. 8.2 Check whether the file is present or not. 8.2 If present then display the contents of the file. 9. Append() 9.1 Get the file name from user. 9.2 Check whether the file is present or not. 9.3 If present then append the file by getting the text to add with the existing file. 10. Delete() 10.1 Get the file name from user. 10.2 Check whether the file is present or not. 10.3 If present then delete the existing file.
  • 6. WAP A C PROGRAM TO CREATE TEXT EDITOR WHICH CONTAIN THE WORKING OF OPEN, SAVE, NEW, EXIT AND RENAME 1 #include<stdio.h> 2 #include<conio.h> 3 #include<process.h> 4 int i,j,ec,fg,ec2; 5 char fn[20],e,c; 6 FILE *fp1,*fp2,*fp; 7 void Create(); 8 void Append(); 9 void Delete(); 10 void Display(); 11 void main() 12 { 13 do { 14 printf("ntt***** TEXT EDITOR *****"); 15 printf("nntMENU:nt-----n "); 16 printf("nt1.CREATEnt2.DISPLAYnt3.APPENDnt4.DELETEnt5.EXITn"); 17 printf("ntEnter your choice: "); 18 scanf("%d",&ec); 19 switch(ec) 20 { a) case 1: b) Create(); c) break; d) case 2: e) Display(); f) break; g) case 3: h) Append(); i) break; j) case 4: k) Delete(); l) break; m) case 5: n) exit(0); 21 } 22 }while(1); 23 } 24 void Create() 25 { 26 fp1=fopen("temp.txt","w");
  • 7. 27 printf("ntEnter the text and press '.' to savennt"); 28 while(1) 29 { 30 c=getchar(); 31 fputc(c,fp1); 32 if(c == '.') 33 { a) fclose(fp1); b) printf("ntEnter then new filename: "); c) scanf("%s",fn); d) fp1=fopen("temp.txt","r"); e) fp2=fopen(fn,"w"); f) while(!feof(fp1)) g) { h) c=getc(fp1); i) putc(c,fp2); j) } k) fclose(fp2); l) break; 34 }} 35 } 36 void Display() 37 { 38 printf("ntEnter the file name: "); 39 scanf("%s",fn); 40 fp1=fopen(fn,"r"); 41 if(fp1==NULL) 42 { a) printf("ntFile not found!"); b) goto end1; 43 } 44 while(!feof(fp1)) 45 { a) c=getc(fp1); b) printf("%c",c); 46 } 47 end1: 48 fclose(fp1); 49 printf("nntPress any key to continue..."); 50 getch(); 51 } 52 void Delete() 53 { 54 printf("ntEnter the file name: "); 55 scanf("%s",fn); 56 fp1=fopen(fn,"r");
  • 8. 57 if(fp1==NULL) 58 { a) printf("ntFile not found!"); b) goto end2; 59 } 60 fclose(fp1); 61 if(remove(fn)==0) 62 { a) printf("nntFile has been deleted successfully!"); b) goto end2; 63 } 64 else a) printf("ntError!n"); 65 end2: printf("nntPress any key to continue..."); 66 getch(); 67 } 68 void Append() 69 { 70 printf("ntEnter the file name: "); 71 scanf("%s",fn); 72 fp1=fopen(fn,"r"); 73 if(fp1==NULL) 74 { a) printf("ntFile not found!"); b) goto end3; 75 } 76 while(!feof(fp1)) 77 { a) c=getc(fp1); b) printf("%c",c); 78 } 79 fclose(fp1); 80 printf("ntType the text and press 'Ctrl+S' to append.n"); 81 fp1=fopen(fn,"a"); 82 while(1) 83 { a) c=getch(); b) if(c==19) c) goto end3; d) if(c==13) e) { f) c='n'; g) printf("nt"); h) fputc(c,fp1); i) } j) else
  • 9. k) { l) printf("%c",c); m) fputc(c,fp1); n) } 84 } 85 end3: fclose(fp1); 86 getch(); 87 } OUTPUT :-
  • 11. CONCLUSION Here, I conclude my lines of my term paper on the topic ‘Text Editors’ with the extreme satisfaction and contentment. This term paper contains brief definition of Text Editor together with its features and functions. Added to this, my term paper contains the basic description to Create, Edit, Save, Delete and Exit from file through C program. It also includes practical implementation of text editors through complex c program which is created by our group. Also I have sincerely included the references from where I have made my term paper. This term paper is the outcome of my hard and laborious work and contains a complete knowledge on the path independent line integral. Here, I end my lines with the hope that my term paper will be equally appreciated and heartily accepted by all. Also, all my faults and mistakes would be forgiven. REFERENCES :-  www.cprogramming.com/texteditors.html  http://en.wikipedia.org/wiki/Text_editor  http://whatis.techtarget.com/definition/text-editor