fputs in c
#include <stdio.h>
int main () {
FILE *fp;
fp = fopen("file.txt", "w+");
fputs("This is c programming.", fp);
fputs("This is a system programming language.", fp);
fclose(fp);
return(0);
}
4.25
4
#include <stdio.h>
int main () {
FILE *fp;
int c;
fp = fopen("file.txt","r");
while(1) {
c = fgetc(fp);
if( feof(fp) ) {
break ;
}
printf("%c", c);
}
fclose(fp);
return(0);
}
Thank you!
4
0
4.5
9
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *p;
int ch;
p=fopen("yourfile","w"))==NULL)
{
printf("Errror");
exit(1);
}
printf("Enter the text:\n");
while(ch=getchar())!=EOF)
fputc(ch,p);
fclose(p);
return 0;
}
Thank you!
9
0
Are there any code examples left?
New code examples in category TypeScript