termios.c 436 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <termios.h>
  4. #include <unistd.h>
  5. #include <asm/ioctls.h>
  6. #include <sys/ioctl.h>
  7. int main(int argc,char *argv[])
  8. {
  9. struct termios t;
  10. int ret;
  11. printf("TCGETS = 0x%08x\n",TCGETS);
  12. printf("sizeof(struct termios) = %ld\n",(long)sizeof(struct termios));
  13. ret = ioctl(fileno(stdout),TCGETS,&t);
  14. if(ret<0){
  15. perror("ioctl");
  16. }else{
  17. printf("ioctl returned %d\n",ret);
  18. }
  19. return 0;
  20. }