File Operations in Tamil


 c-fputc

Learn C - C tutorial - C fputc - C examples - C programs

C - fputc() - Definition and Usage

  • In C – Programming , the fputc function is used to write the character from the file.
C fputc

C Syntax

 int fputc( int c, FILE * stream );

Sample - C Code

#include <stdio.h>
#include <conio.h>
void main()
{
    FILE *fp1;
    fp1=fopen("sample.txt","w");
    fputc('W',fp1);
    fputc('I',fp1);
    fputc('K',fp1);
    fputc('I',fp1);
    fputc('T',fp1);
    fputc('E',fp1);
    fputc('C',fp1);
    fputc('Y',fp1);
    getch();
}

C Code - Explanation

code-explanation-fputc
  1. Here in this statement we create a file pointer “fp1”.
  2. Here in this statement we open the text file using “fopen” function in writing mode.
  3. In this statement we write the character in the text file using fputc function.

Sample Output - Programming Examples

code-explanation-fputc-output
  1. Here in this output the statement “WelcomeToWikitechy” in the notepad file (sample.txt) has been shown which is located in the BIN folder of C.

C - putc()

  • In C – Programming , Putc function writes the content in the file.

Syntax

 putc(“character”, FilePointer)
putc

Sample Code

#include<stdio.h>
#include<conio.h>
void main()
{
	FILE *fp;
	char ch;
fp = fopen("one.txt", "w");
printf("Enter data...");
while( (ch = getchar()) != EOF) 
{
	putc(ch, fp);
}
	fclose(fp);
}

Output

 c-fread

View More Quick Examples


Related Searches to C fputc

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×