Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PRIMA DI INIZIARE
● man comando
● man -k comando
● man -f comando
Passi 1,2,3 :
Si ricopia il valore dei parametri sullo stack
Come avviene una SC?
sistematicamente
SC: ERRORI
/*error testing per una SC */
if ( (e = read (fd, buf, numbyte ) ) == -1 )
{
/* gestione errore minimale */
fprintf(stderr,”Read failed!\n”);
exit(EXIT_FAILURE); /* standard C stdlib.h*/
}
SC: ERRORI
#include <errno.h>
……
/*error testing per una SC */
if ( (e = read (fd, buf, numbyte ) ) == -1 )
{
/* usare errno */
fprintf(stderr,”Read failed! Err:
%d\n”,errno);
exit(EXIT_FAILURE); /* standard C */
}
SC: ERRORI
Possibile output:
bash:~$ a.out
Read failed! Err: 9
bash:~$
perror()
perror() routine della libreria standard C che
stampa i messaggi di errore relativi a diversi codici
(includere stdio.h,errno.h)
Oppure:
Creare un file
Oppure:
Oppure 2:
Chiudere un file
Muoversi nel file: lseek
Valori di whence:
- SEEK_SET: l'offset viene impostato ad offset