Missing required fields
Posted by bluez Wed 28th Feb 2007 17:39 - Syntax is None/text - 88 views
Download | New Post | Modify | Hide line numbers
Description:
sr02 en force

  1. #include
  2. #include
  3. #include
  4. #include
  5. #include
  6.  
  7.  
  8. int main(int argc,char* argv[])
  9. {
  10.  
  11. char buf[10];
  12. char lu;
  13. struct termios tt_avant, tt_apres;
  14.  
  15. //recuperation d errread(0,buf,10);eurs et recuperation du bloc de controle standard dans tt_avant
  16. if(tcgetattr(0, &tt_avant)==-1)
  17.     {perror("tcgetattr"); exit(1);}
  18.  
  19. tt_apres=tt_avant;
  20. tt_apres.c_iflag &= ~(IXON|IXOFF);
  21. tt_apres.c_lflag &= ~(ICANON|ECHO);
  22. tt_apres.c_cc[VMIN]=1;
  23.  
  24. //int tcsetattr(int fd, int optional_actions, struct termios *termios_p);
  25.  
  26. if(tcsetattr(0,TCSANOW, &tt_apres)==-1)
  27.     {perror("tcsetattr"); exit(1);}
  28.  
  29. do
  30. {
  31. read(0,buf,10);
  32. lu=buf;
  33. printf("%d caractere lu= %c\n",strlen(buf),lu);
  34. fflush(&buf);
  35. }
  36. while (lu!='F');
  37.  
  38. if(tcsetattr(0,TCSANOW, &tt_avant)==-1)
  39.     {perror("tcsetattr"); exit(1);}
  40.  
  41. return 0;
  42.  
  43. }

PermaLink to this entry https://pastebin.co.uk/11171
Posted by bluez Wed 28th Feb 2007 17:39 - Syntax is None/text - 88 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0