Je cherche a obtenir la taille de la Fenetre principal afin de pouvoir la diviser en 2 a la verticale. un peux comme mignight commander, mai vraiment 2 fenetre séparée et indépendante.
Note Je decouvre ncuse et également le c++ (bon le c++ depuis 2 ou 3 mois sa commence a rentrer)
mai j’ai rien trouver en ce qui concerne mon probleme car c’est a moi de fournir les première cordonné aux pif. pour la première (box ?) avec le code suivant:
la fonction ncurse_affichage(); peux etre remplacée par le main aux besoin (ou si sa bug …)
#include <ncurses.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
WINDOW *create_newwin(int height, int width, int starty, int startx);
ncurse_affichage();
void ncurse_affichage()
{
WINDOW *my_win;
int startx, starty, width, height;
initscr();
height = 30; /* c est ici que je fournis les dimention pour la box ou la windows ? */
width = 100;
starty = (LINES - height) / 2; /* Calculating for a center placement */
startx = (COLS - width) / 2; /* of the window */
my_win = create_newwin(height, width, starty, startx);
}
WINDOW *create_newwin(int height, int width, int starty, int startx)
{ WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
box(local_win, 0 , 0); /* 0, 0 gives default characters
* for the vertical and horizontal
* lines */
wrefresh(local_win); /* Show that box */
return local_win;
}
Échec de la connexion sécurisée
sinon voila ce qu'on ma proposer :)
[code]
#include <iostream>
#include <ncurses.h>
int main()
{
initscr();
cbreak();
while(true)
{
std::cout << LINES << " " << COLS << std::endl;
refresh();
sleep(1);
}
}
[/code]
forum.debian-fr.org utilise un certificat de sécurité invalide.
Le certificat n'est pas sûr car il est auto-signé.
Le certificat n'est valide que pour *.zehome.com.
(Code d'erreur : sec_error_untrusted_issuer)
bon j’ai fini par trouver comment,avidement c’est surpert simple… quand on comprend l’anglais grr…
initscr(); /*on lance ncurses*/
//on retrouve les information dans:
//LINES, COLS
//exemple:
#include <iostream>
#include <ncurses.h>
#include <string>
#include <cstring>
using std::string;
WINDOW *create_newwin(int height, int width, int starty, int startx);
void destroy_win(WINDOW *local_win);
void print_position( WINDOW *local_win,int V , int H,string my_string);
int main()
{
WINDOW *my_win;
initscr();
my_win = create_newwin(LINES, COLS/2, 0, 0);
print_position(my_win,1,1,"ONE WINDOW");
sleep(10);
destroy_win(my_win);
endwin();
return 0;
WINDOW *create_newwin(int height, int width, int starty, int startx)
{ WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
box(local_win, 0 , 0);
wrefresh(local_win);
return local_win;
}
void destroy_win(WINDOW *local_win)
{
/* box(local_win, ' ', ' '); : This won't produce the desired
* result of erasing the window. It will leave it's four corners
* and so an ugly remnant of window.
*/
wborder(local_win, '+ ', '+ ', '+ ','+ ','+ ','+ ','+ ','+ ');
/* The parameters taken are
* 1. win: the window on which to operate
* 2. ls: character to be used for the left side of the window
* 3. rs: character to be used for the right side of the window
* 4. ts: character to be used for the top side of the window
* 5. bs: character to be used for the bottom side of the window
* 6. tl: character to be used for the top left corner of the window
* 7. tr: character to be used for the top right corner of the window
* 8. bl: character to be used for the bottom left corner of the window
* 9. br: character to be used for the bottom right corner of the window
*/
wrefresh(local_win);
delwin(local_win);
}
void print_position(WINDOW *local_win, int V, int H, std::string my_string)
{
if (V == 0 and H == 0)
{
printw(my_string.c_str());
refresh();
}
else
{
mvwprintw(local_win, V, H, my_string.c_str());
wrefresh(local_win);
}
}