what am I missing?

new topic     » topic index » view thread      » older message » newer message

here C code from termbits.h

typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;

  1. define NCCS 19 /* there should be a sharp character before define not 1. */

    struct termios2 {
    tcflag_t c_iflag; /* input mode flags */
    tcflag_t c_oflag; /* output mode flags */
    tcflag_t c_cflag; /* control mode flags */
    tcflag_t c_lflag; /* local mode flags */
    cc_t c_line; /* line discipline */
    cc_t c_cc[NCCS]; /* control characters */
    speed_t c_ispeed; /* input speed */
    speed_t c_ospeed; /* output speed */
    };

    from this I compute 44 bytes for termios2 struct:
    4*4 + 1 + 19 + 2*4 = 44
    But if I allocate 44 bytes my program crash.
    I must allocate 45 bytes for it to works. Where is the missing byte?

    Jacques
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu