Getc And Putc

in Hindi - Getc And Putc



getc and putc ये दोनों File Handling के Functions है |

getc : getc function किसी file से एक character पढ़ने के लिए use करते है
Syntax :
getc ( File Pointer );

putc : putc function किसी file में एक character लिखने के लिए use करते है |
Syntax :
putc( variable or 'character' , File Pointer);


Source Code :

RUN#include <stdio.h>
#include <conio.h>

void main()
{
char c;
FILE *fptr;

fptr = fopen("File.txt", "w");

printf("Enter character");
scanf("%c", &c);

putc(c,fptr);

fclose(fptr);

fptr = fopen("File.txt", "r");

while( (c = getc(fptr))!= EOF){

printf("You entered %c",c);
}

fclose(fptr);
getch();
}