-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfile_append_EOS.c
More file actions
47 lines (36 loc) · 861 Bytes
/
file_append_EOS.c
File metadata and controls
47 lines (36 loc) · 861 Bytes
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
#include<stdio.h>
#include<string.h>
int main(){
//File Pointer
FILE *fp;
//Variable
char file[500];
//File Name
printf("Enter File Name : ");
scanf("%s",file);
//Opening File
fp=fopen(file,"a");
if(fp!=NULL){
while(1){
//Sentence(s)
printf("\n* To End The Sentence type 'EOS' *\n");
printf("Enter The Sentence(s) :");
scanf(" %[^\n]s",file);
//Check For EOS - End Of Sentence
if(strcmp(file,"EOS")==0){
break;
}else{
//Print in File
fprintf(fp,"\n%s",file);
}
}
//Close File
fclose(fp);
}else{
//Message
printf("\nERROR. \nInvalid File \n");
//Close File
fclose(fp);
}
return 0;
}