Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Libreria STRCONS - stringa_console.h

stringa_console.h

Caricato da: AldoBaldo
Scarica il programma completo

  1. /// =========================== LIBRERIA STRCONS =========================== ///
  2. ///                            di Aldo Carpanelli                            ///
  3. ///                          v1.1,  13/11-6/12 2016                          ///
  4. /// ======================================================================== ///
  5.  
  6.  
  7. #ifndef STRCONS_H
  8. #define STRCONS_H
  9.  
  10.  
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include <locale.h>
  15.  
  16.  
  17. /// ===> gestione degli errori <============================================ ///
  18.  
  19. enum {
  20.     STRCONSErr_no_str = -2,  // l'input e' una stringa vuota
  21.     STRCONSErr_troncato,     // buffer insufficiente, input troncato
  22.     STRCONSErr_no_err,       // nessun errore, tutto bene
  23.     STRCONSErr_no_mem,       // memoria insufficiente
  24.     STRCONSErr_enorme,       // dimensioni del buffer insensate
  25.     STRCONSErr_no_fgets,     // errore in fgets()
  26.     STRCONSErr_no_num        // il buffer non rappresenta un numero
  27. };
  28.  
  29. #define STRCONSErr_MaxIndStrErr 7 // indice massimo delle stringhe d'errore
  30.  
  31. const char *STRCONSErr_Descrizione( int codice );
  32.  
  33.  
  34. /// ===> inizializzazione e dismissione <=================================== ///
  35.  
  36. int STRCONS_Inizializza( size_t dim );
  37. void STRCONS_Dismetti( void );
  38.  
  39.  
  40. /// ===> modifica dello stato della libreria <============================== ///
  41.  
  42. int STRCONS_Dimensiona( size_t dim );
  43. int STRCONS_Chiedi( void );
  44.  
  45.  
  46. /// ===> informazioni sullo stato della libreria <========================== ///
  47.  
  48. size_t STRCONS_Capacita( void );
  49. size_t STRCONS_Lunghezza( void );
  50. char *STRCONS_PStr( void );
  51. int STRCONS_Long( long *l, int base );
  52. int STRCONS_UnsignedLong( unsigned long *ul, int base );
  53. int STRCONS_Double( double *d );
  54.  
  55.  
  56. /// ===> funzioni accessorie <============================================== ///
  57.  
  58. size_t STRCONS_EliminaNewline( char *str, size_t lung );
  59. size_t STRCONS_SvuotaStdin();
  60. void STRCONS_AdattaPuntoDecimale( void );
  61.  
  62. #endif // STR_CONS_H