Forums ProgMatique Forum Index Forums ProgMatique
Programmation (C/C++, JAVA, PHP, JavaScript, ...) et Informatique (Webmaster, Web)

aide pour apli UNIX

 
Post new topic   Reply to topic    Forums ProgMatique Forum Index » Programmation » C / C++
Previous topic :: Next topic  
Author Message
thibault


Offline


Joined: 01 Apr 2009
Posts: 5

PostPosted: Wed 1 Apr 2009 - 10:40    Post subject: aide pour apli UNIX Reply with quote

Bonjour
j ai besoin daide pour faire un bout de code pour faire une aplicatuion sur UNIX
mais avnt de monter mon code , je ne trouve pas le bouton pour metre le code
car je vais vous metre le code source end ur

Thibault
Back to top
SimMaster
Administrateur
Administrateur

Online


Joined: 08 May 2005
Posts: 492
Localisation: France

PostPosted: Wed 1 Apr 2009 - 11:58    Post subject: aide pour apli UNIX Reply with quote

Bonjour et Bienvenue
Le bouton Code est le bouton "<>".
Tu peut aussi tout simplement copier le code source puis au début ajouter [code] et à la fin ajouter [/code]

Si tu souhaite coloriser le code-source, tu peut aussi utiliser le service CodesWall.
_________________
SimMaster,
Programmation et informatique
Colorisation syntaxique de codes sources
Outils et services autour de l'adresse IP
Back to top
Visit poster’s website
thibault


Offline


Joined: 01 Apr 2009
Posts: 5

PostPosted: Fri 3 Apr 2009 - 12:04    Post subject: aide pour apli UNIX Reply with quote

Voila le fameu code
Code:
#include <sys/ioctl.h>
#include <sys/termios.h>

void   change_tty()
{
 struct termios p;
  if (ioctl(0, TIOCGETA, &p))
    {
      puts("erroro11");
      exit(1);
    }
  p.c_lflag &= ~ICANON;
  p.c_cc[VMIN] = 1;
  p.c_cc[VTIME] = 0;
  if (ioctl(0, TIOCGETA, &p))
    {
         puts("erroro22");
    exit(1);
    }   
}

int   main()
{
  char c;
  char str[1024];
  int i;
  i = 0;
  change_tty();
   while (c != '\n')
    {
      c = getchar();
      if (c == 9)
   puts("toto");
      str[i] = c;
      i++;
      printf("c =%c\n", c);
      }
}



Je voudrais en faite pouvoir recuper uen commande atper sur lentre , mais aussi pouvoir gere certaine touche comme la touche tab (cest pour emuler le code dun terminal)

merci de me dire pourquoi dans ce code qund je touche sur la tocuhe tab dont le code ascii est 9 toto ne saffiche pas tout de suite

merci
Back to top
Ben


Offline


Joined: 03 Jun 2009
Posts: 57

PostPosted: Thu 4 Jun 2009 - 21:18    Post subject: aide pour apli UNIX Reply with quote

Essaye avec ça à la place de ton main :
Code:

int   main()
{
  char c;
  char str[1024];
  int i;
  i = 0;
  change_tty();
  while (c != '\n')
  {
      c = getchar();
      if (c == 9)
      {
        puts("toto");
        fflush(stdout);
      }
      str[i] = c;
      i++;
      printf("c =%c\n", c);
      fflush(stdout);
  }
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forums ProgMatique Forum Index » Programmation » C / C++ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Create a forum | Free support forum | Free forums directory | Report a violation | Conditions générales d'utilisation
Powered by phpBB v2 © 2001, 2005 phpBB Group ¦ Theme: subSilver++