APPENDICE PROTOTIPI DI FUNZIONE
MEMORIA
void * malloc ( size_t size );
void free ( void * ptr );
FILE
FILE * fopen ( const char * filename, const char * mode ); // NULL error int fclose ( FILE * stream ); // zero ok
int feof ( FILE * stream );
int fprintf ( FILE * stream, const char * format, ... ); // <0 error int fscanf ( FILE * stream, const char * format, ... ); // zero/EOF error int fgetc(FILE *stream); //EOF Error
int fputc(int c, FILE *stream); //EOF Error
size_t fwrite (const void * ptr, size_t size, size_t count, FILE * stream); // count ok size_t fread (void * ptr, size_t size, size_t count, FILE * stream); // count ok long int ftell ( FILE * stream ); // -1 error
int fseek(FILE *stream, long int offset, int origin);// SEEK_SET/CUR/END zero ok void rewind ( FILE * stream );
int fflush(FILE *stream); //Libera il buffer di stream int remove ( const char *nomefile);
int rename (const char *nomeante, const char *nomepost); // -1 error Funzione generatore numeri casuali
#include <stdlib.h>
#include <time.h> //Per utilizzare time(NULL)
void srand( time(NULL)); //Inizializza il generatore di numeri casuali
variabile = rand() % n + 1 //variabile è un numero casuale compreso tra 1 e n CONVERSIONI
int atoi ( const char * str ); // zero error double atof ( const char * str ); // zero error
char * itoa ( int value, char * str, int base ); // NOT ANSI use sprintf STRINGHE
int sprintf ( char * str, const char * format, ... ); // <0 error char * strchr ( char * str, int character ); // NULL error
char * strrchr ( char * str, int character ); // NULL error char * strstr ( char * str1, const char * str2 ); // NULL error char * strrev ( char *str );