0% found this document useful (0 votes)
4 views

Files

Uploaded by

Chetan Cherry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Files

Uploaded by

Chetan Cherry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
You are on page 1/ 4

fopen() - stream open function

SYNOPSIS
#include <stdio.h>

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

Description : The fopen() function opens the file whose


name is the string pointed to by path and associates a
stream with it.
The argument mode points to a string beginning with one
of the following sequences

1) r 2) r+ 3) w 4) w+ 5) a 6) a+

Return value: Success : FILE*


Failure : NULL
fgetc() - input of characters
SYNOPSIS
#include <stdio.h>
int fgetc(FILE *stream);

DESCRIPTION :
fgetc() reads the next character from stream and returns it
as an unsigned char cast to an int, or EOF on end of file or error.
RETURN VALUE
fgetc() return the character read as an unsigned char cast to
an int or EOF on end of file or error.
fputc - output of characters

SYNOPSIS
#include <stdio.h>
int fputc(int c, FILE *stream);

DESCRIPTION
fputc() writes the character c, cast to an unsigned char, to stream.

RETURN VALUE
fputc() return the character written as an unsigned char cast to an
int or EOF on error.
fclose - close a stream

SYNOPSIS

#include <stdio.h>
int fclose(FILE *fp);
DESCRIPTION

The fclose() function flushes the stream pointed to by fp (writing any


buffered output data using fflush(3)) and closes the underlying file
descriptor.

The behaviour of fclose() is undefined if the stream parameter is an


illegal pointer, or is a descriptor already passed to a previous invo‐
cation of fclose().

RETURN VALUE
Upon successful completion 0 is returned. Otherwise, EOF is returned

You might also like