Tuesday, May 19, 2020

Learn about all stdio.h headerfile function in c programming

clearerr() function in c programming use to clear the error and end-of-file which is given by the pointer stream as shown in syntax 

 Syntax :-  

void clearerr(FILE *stream);

fclose function in c programming : -

fcolse() function in c use to close all buffer and unwanted  written data in stream pointed by *stream.

 Syntax : - 

int fclose(FILE *stream);

fefo() function in c programming : -

fefo() function in c programming is used to validate for end of file is reached or not.

Syntax : - 

int feof(FILE *stream);

ferror() function in c programming : -


ferror() function in c programming is used to check error indecator for a stream pointer to by steam.

Syntax : - 


int ferror(FILE *stream);

fflush() function in c programming : -


fflush() function in c use for file headling it is used to flush/clear the file and buffer. 

Syntax : -

int fflush(FILE *stream);

fgetc() function in c programming : -


fgetc() function in c use in file headling.It is used to read a line in from the specified file and store it into a string. It stops when either n-1 character is read or newline character is read and end of file is reached.

Syntax : - 

int fgetc(FILE *stream);

fgetpos() function in c programming : -

fgetpos() function in c programming use to store the current position of stream into a defined object pointed by pos.

Syntax : -

int fgetpos(FILE *stream, fpos_t *pos);

fgets() function in c programming : - 

fgets() function in c programming use to read the character from the file pointed by stream. It stops when either n-1 character is read or newline character is read and end of file is reached.

Syntax : -

char *fgets(char *s, int n, FILE *stream);

fopen() function in c programming : -

fgets() function in c programming use to open a file to perform various operations like writting, reading etc.

Syntax: - 

FILE *fopen(const char *filename, const char *mode);

fprintf() function in c programming : -

fprintf() function in c programming language is used to write a formatted output to stream.

Syntax : -

int fprintf(FILE *stream, const char *format, ...);

fputc() function in c programming : -

fputc() function in c language is used to write a character into a file. This function writes on character at a time and move the pointer where the next character is going to write.

Syntax : -

int fputc(int c, FILE *stream);

fputs() function in c programming : -

fputs() function in c language is used to write a string into a file. It accepts two arguments pointer to string and file pointer.

Syntax : - 

int fputs(const char *s, FILE *stream);

fread() function in c programming : -

fread() function in c language is used to read the data from pointed file and store in a pointer *ptr.

Syntax : - 

size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);

freopen() function in c programming : -

freopen() function in c language is used to open an new file associated it with stream in c programming and also close old file in the stream.

Syntax:-
FILE *freopen(const char *filename, const char *mode, FILE *stream);


fscanf() function in c programming : -

fscanf() function in c programming is used to read the formatted output.

Syntax : - 

int fscanf(FILE *stream, const char *format, ...);
  

fseek() function in c programming : -

fseek() function in c language is use to move the file pointer position to the given position.
Syntax : - 

int fseek(FILE *stream, long int offset, int whence);

fsetpos() function in c programming : -

fsetpos() function in c language is use to move the file position to given indicated location for the stream. It also reset the indecator at the end-of-file. 

Syntax : -

int fsetpos(FILE *stream, const fpos_t *pos);

ftell() function in c programming : -

fsetpos() function in c programming language is use to return the current position of file for the stream pointed by stream.

 Syntax : -

long int ftell(FILE *stream);

fwrite() function in c programming : -

fwrite() function in c language is use to write nmemb into a pointed file in c program.

 Syntax : -
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);

fwrite() function in c programming : -

fwrite() function work as same as fread() function in c programming these function use to read a character from the stream pointed to by stream.

 Syntax : -
int getc(FILE *stream);

getc() function in c programming : -

getc() function in c programming read the characters from c file stdin stream.

 Syntax : -
int getchar(void);

getc() function return the read character

gets() function in c programming : -

gets() function in c programming read the characters and store into a pointer *s

 Syntax : -

char *gets(char *s);

gets() function return s

perror() function in c programming : -

perror() function in c is very important function this function send a error message to stderr stream into following format:-

string: error-message

 Syntax : -
void perror(const char *s);

putc() function in c programming : -

putc() function is used to display a characters on standard output or it use to write into a file in c programming.
  
Syntax : - 

 int putc(int c, FILE *stream);

putc() function return the write character

putchar() function in c programming : -

putchar() function in c programming use to write a character into the stdout stream or output stream.

Syntax : - 

int putchar(int c);

puts() function in c programming : -

putchar() function in c programming use to write a string into a stdout file in c.

 Syntax : -

int puts(const char *s);

it return the non negative value if successful.

remove() function in c programming : -


remove() function in c programming use to remove a file which is pointed by filename in c.

 Syntax : - 

int remove(const char *filename);

it return the zero if file remove successful.

rename() function in c programming : -


rename() function in c use to rename a specified file in c. You have to close that file before rename it because a file can not be renamed if that file is open.

 Syntax : -

int rename(const char *old, const char *new);

it return the zero if file renamed successfully.

rewind() function in c programming : -


rename() function in c programming set the file position to the beginning of the file for the stream pointed ny the stream.

 Syntax : -

void rewind(FILE *stream);

setbuf() function in c programming : -


setbuf() function in c programming let you changed the way of buffered and also let you set the size and location of the buffer otherwise it takes default values in c.

Control buffer : -

(void) setvbuf(stream, buf, _IOFBF, BUFSIZ);

default buffer : - 

(void) setvbuf(stream, NULL, _IONBF, 0);

 Syntax : -

void setbuf(FILE  *stream, char *buf);


tmpfile() function in c programming : -


tmpfile() function in c programming creates the temporary file.
temporary file will be deleted if you close that file or at the end of the programs.

 Syntax : -
FILE *tmpfile(void);

tmpnam() function in c programming : -


tmpfile() function in c programming gives a name to the  temporary file.If the argument is a null pointer, then it store an static file name otherwise it store the changed file name into s.

 Syntax : -

char *tmpnam(char *s);


These all are the file handling in c programming which is going to use in stdio.h header file before using it don't forget to include the stdio.h header file on the head.

0 comments:

Post a Comment