fputs. McGraw-Hill The Complete Reference Fourth Edition
जाहिरात
जाहिरात
706
C + + : T h e C o m p l e t e R e f e r e n c e
fputs
Related functions are fgetc( ), fopen( ), fprintf( ), fread( ), and fwrite( ).
#include <cstdio> int fputs(const char * str, FILE *stream);
The fputs( ) function writes the contents of the string pointed to by str to the specified stream. The null terminator is not written.
The fputs( ) function returns nonnegative on success and EOF on failure.
If the stream is opened in text mode, certain character translations may take place.
This means that there may not be a one-to-one mapping of the string onto the file.
However, if the stream is opened in binary mode, no character translations will occur, and a one-to-one mapping between the string and the file will exist.
Related functions are fgets( ), gets( ), puts( ), fprintf( ), and fscanf( ).
fread
#include <cstdio> size_t fread(void * buf, size_t size, size_t count,
FILE * stream);
The fread( ) function reads count number of objects, each object being size bytes in length, from the stream pointed to by stream and places them in the array pointed to by
buf. The file position indicator is advanced by the number of characters read.
The fread( ) function returns the number of items actually read. If fewer items are read than are requested in the call, either an error has occurred or the end of the file has been reached. You must use feof( ) or ferror( ) to determine what has taken place.
If the stream is opened for text operations, certain character translations, such as carriage return/linefeed sequences being transformed into newlines, may occur.
Related functions are fwrite( ), fopen( ), fscanf( ), fgetc( ), and getc( ).
freopen
#include <cstdio>
FILE *freopen(const char * fname, const char *mode,
FILE * stream);
डाउनलोड
जाहिरात