Jump to content
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Compilateur C++ sous linux

Featured Replies

J'ai la version SuSe 1.8, j'ai installé le compilateur C++ mais cependant, certain programme que j'ai ecrit et qui focntionne sous windows ne fonctionne pas sous linux. Par exemple, le fichier d'entete <conio.h> n'existe pas sous linux et donc une fonction comme getch() représente une erreur lors de la compilation du programme sous linux.

Comment puis je m'en sortir?

Salut !

Tu ne trouevras pas de conio.h avec le compilateur GCC !

Voila comment tu peux faire pour lire l'entrée d'une touche :

#include <stdio.h>

#include <termios.h>

#include <term.h>

#include <curses.h>

#include <unistd.h>

static struct termios initial_settings, new_settings;

static int peek_character = -1;

void init_keyboard();

void close_keyboard();

int kbhit();

int readch();

int main()

{

int ch = 0;

init_keyboard();

while( ch != 'q' ) {

printf("Loopingn");

sleep(1);

if( kbhit() ) {

ch = readch();

printf("You hit %cn",ch);

}

}

}

void init_keyboard()

{

tcgetattr( 0, &initial_settings );

new_settings = initial_settings;

new_settings.c_lflag &= ~ICANON;

new_settings.c_lflag &= ~ECHO;

new_settings.c_lflag &= ~ISIG;

new_settings.c_cc[VMIN] = 1;

new_settings.c_cc[VTIME] = 0;

tcsetattr( 0, TCSANOW, &new_settings );

}

void close_keyboard()

{

tcsetattr( 0, TCSANOW, &initial_settings );

}

int kbhit()

{

char ch;

int nread;

if( peek_character != -1 )

return( 1 );

new_settings.c_cc[VMIN] = 0;

tcsetattr( 0, TCSANOW, &new_settings );

nread = read( 0, &ch, 1 );

new_settings.c_cc[VMIN] = 1;

tcsetattr( 0, TCSANOW, &new_settings );

if( nread == 1 ) {

peek_character = ch;

return( 1 );

}

return( 0 );

}

int readch()

{

char ch;

if( peek_character != -1 ) {

ch = peek_character;

peek_character = -1;

return( ch );

}

read( 0, &ch, 1 );

return( ch );

}

Archived

This topic is now archived and is closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.