Answers for "fputc in c"

0

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);
}
Posted by: Guest on July-11-2020
0

fputs in c

#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);
}
Posted by: Guest on July-11-2020
0

fputc in c

#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;
}
Posted by: Guest on June-17-2021

Browse Popular Code Answers by Language