Text editors project
Upcoming SlideShare
Loading in...5
×
 

Text editors project

on

  • 121 views

project on text editors

project on text editors

Statistics

Views

Total Views
121
Views on SlideShare
121
Embed Views
0

Actions

Likes
1
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Text editors project Text editors project Document Transcript

  • 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 :-
  • 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