Un fread qui n'en fait qu'a sa tete (C++)
Fermé
EYZO
Messages postés
5
Date d'inscription
mercredi 15 mai 2002
Statut
Membre
Dernière intervention
27 juin 2002
-
24 mai 2002 à 14:27
jisisv Messages postés 3645 Date d'inscription dimanche 18 mars 2001 Statut Modérateur Dernière intervention 15 janvier 2017 - 24 mai 2002 à 16:06
jisisv Messages postés 3645 Date d'inscription dimanche 18 mars 2001 Statut Modérateur Dernière intervention 15 janvier 2017 - 24 mai 2002 à 16:06
A voir également:
- Un fread qui n'en fait qu'a sa tete (C++)
- Un mot est caché dans l'en-tête du document. pour le trouver, modifiez sa couleur. ✓ - Forum Word
- L'en-tête du document comporte une information qui n’apparaît pas à l'impression car elle est de couleur blanche. de quelle information s'agit-il ? ✓ - Forum Bureautique
- Tête lnb défectueuse - Forum Vidéo/TV
- Quel solvant pour nettoyage tete d'impression ✓ - Forum Imprimante
- Ajoutez à la liste de contacts ana le goff, inscrite le 27 novembre 2015, dans la catégorie i. puis triez les contacts en les classant : par ordre alphabétique de leur nom de famille (critère principal), puis par date du plus récent au plus ancien (critère secondaire). quel mot apparaît à la verticale dans la colonne "catégorie" entre les lignes 200 et 209 (en-tête compris) ? ✓ - Forum Word
1 réponse
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
947
24 mai 2002 à 16:06
24 mai 2002 à 16:06
D'abord, ton buffer fait 15 bytes au lieu de 16.
Si tu veux lire des lignes de texte, ajuste la taille de ton buffer et utilise fgets
char *fgets(char *s, int size, FILE *stream);
fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer.
FREAD(3) Linux Programmer's Manual FREAD(3)
NAME
fread, fwrite - binary stream input/output
SYNOPSIS
#include <stdio.h>
size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream);
DESCRIPTION
The function fread reads nmemb elements of data, each size bytes long, from the stream pointed to
by stream, storing them at the location given by ptr.
The function fwrite writes nmemb elements of data, each size bytes long, to the stream pointed to
by stream, obtaining them from the location given by ptr.
RETURN VALUE
fread and fwrite return the number of items successfully read or written (i.e., not the number of
characters). If an error occurs, or the end-of-file is reached, the return value is a short item
count (or zero).
fread does not distinguish between end-of-file and error, and callers must use feof(3) and fer
ror(3) to determine which occurred.
CONFORMING TO
The functions fread and fwrite conform to ANSI X3.159-1989 (``ANSI C'').
SEE ALSO
feof(3), ferror(3), read(2), write(2)
BSD MANPAGE 1996-05-17 FREAD(3)
Gates gave us the windows.
Linux gave us the whole house....
Si tu veux lire des lignes de texte, ajuste la taille de ton buffer et utilise fgets
char *fgets(char *s, int size, FILE *stream);
fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer.
FREAD(3) Linux Programmer's Manual FREAD(3)
NAME
fread, fwrite - binary stream input/output
SYNOPSIS
#include <stdio.h>
size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream);
DESCRIPTION
The function fread reads nmemb elements of data, each size bytes long, from the stream pointed to
by stream, storing them at the location given by ptr.
The function fwrite writes nmemb elements of data, each size bytes long, to the stream pointed to
by stream, obtaining them from the location given by ptr.
RETURN VALUE
fread and fwrite return the number of items successfully read or written (i.e., not the number of
characters). If an error occurs, or the end-of-file is reached, the return value is a short item
count (or zero).
fread does not distinguish between end-of-file and error, and callers must use feof(3) and fer
ror(3) to determine which occurred.
CONFORMING TO
The functions fread and fwrite conform to ANSI X3.159-1989 (``ANSI C'').
SEE ALSO
feof(3), ferror(3), read(2), write(2)
BSD MANPAGE 1996-05-17 FREAD(3)
Gates gave us the windows.
Linux gave us the whole house....