View Single Post
Old 20-10-2003, 10:02   #3
Arpeda
Senior Member
 
L'Avatar di Arpeda
 
Iscritto dal: Nov 2000
Messaggi: 342
puoi usare queste:

NAME
fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings

SYNOPSIS
#include <stdio.h>

int fgetc(FILE *stream);
char *fgets(char *s, int size, FILE *stream);
int getc(FILE *stream);
int getchar(void);
char *gets(char *s);
int ungetc(int c, 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.

getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once.

getchar() is equivalent to getc(stdin).

gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'.
No check for buffer overrun is performed (see BUGS below).

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.

ungetc() pushes c back to stream, cast to unsigned char, where it is available for subsequent read operations. Pushed - back charac-
ters will be returned in reverse order; only one pushback is guaranteed.

Calls to the functions described here can be mixed with each other and with calls to other input functions from the stdio library for
the same input stream.

For non-locking counterparts, see unlocked_stdio(3)

mentre per il fatto di dover salvare in binario, premetto che qui posso dire un sazzo di cavolate ...

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 loca-
tion 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.

magari attendi qualcuno più esperto di me per maggiori spiegazioni e dettagli

Ciao
Arpeda
__________________
Membro di HWU Scout Group || Quello che ieri era fantascienza oggi è realtà, quello che oggi è realtà domani sarà solo un ricordo ...
Powered by Gentoo 1.4 on kernel 2.6.12.-gentoo-r4
Arpeda è offline   Rispondi citando il messaggio o parte di esso