je voudrais savoir la fonction equivalente en C++ de:
fread(TGAcompare,1,sizeof(TGAcompare),file)!=sizeof(TGAcompare
Version imprimable
je voudrais savoir la fonction equivalente en C++ de:
fread(TGAcompare,1,sizeof(TGAcompare),file)!=sizeof(TGAcompare
Fonction membre read de ton stream...
il me semble qu'il faut plus que ça pour obteniru la taille lue...
Code:
1
2 is->rdbuf()->sgetn(); is->read() + is->gcount();
Bonjour,
Franc82 écrit :
Non il n' y pas a d' équivalent en C++. Les flux de C++ doivent être interrogés par des méthodes supplémentaires. C' est un point noir du C++ par rapport au C.Citation:
je voudrais savoir la fonction equivalente en C++ de:
fread(TGAcompare,1,sizeof(TGAcompare),file)!=sizeof(TGAcompare
Solution, créer une classe qui encapsule le FILE * , afin de retrouver les fonctionnalités du C .
Cordialement.
C'est ça que tu voulais ?Citation:
istream:: readsome
streamsize readsome (char* s, streamsize n );
Read a block of data.
Reads a block of data with a size determined by the smaller between parameter n and the number of available characters in the stream before the end of its buffer.
Parameters.
s
Pointer to an array of characters to be read.
n
Integer value of type streamsize representing the maximum size of the block to be read.
Return Value.
The function returns an integer value of type streamsize representing the number of characters successfully read.