尊龙凯时人生就是搏

linuxÏÂÄĸöÍ·ÎļþÊÇ¿ØÖƹâ±êµÄ

ÔÚlinuxÖÐ £¬¿ØÖƹâ±êµÄÍ·ÎļþÊÇ¡°curses.h¡±»ò¡°ncurses.h¡± £¬ÌṩÁËÓÃÓÚÆÁÄ»ÉϵĹâ±ê¿ØÖÆ¡¢Îı¾Êä³ö¡¢ÑÕÉ«ÉèÖõȹ¦Ð§¡£

±¾½Ì³Ì²Ù×÷ϵͳ£ºLinux5.18.14ϵͳ¡¢Dell G3µçÄÔ¡£

ÔÚLinuxÖÐ £¬¿ØÖƹâ±êµÄÍ·ÎļþÊÇ »ò £¬ËüÃÇÌṩÁËÓÃÓÚÆÁÄ»ÉϵĹâ±ê¿ØÖÆ¡¢Îı¾Êä³ö¡¢ÑÕÉ«ÉèÖõȹ¦Ð§¡£

ÒªÔÚLinuxÖÐÉèÖúÍʹÓÃÕâЩͷÎļþ £¬ÄúÐèÒªÖ´ÐÐÒÔÏ°취£º

1¡¢×°ÖÃncurses¿â£º

Ê×ÏÈ £¬È·±£ÄúµÄϵͳÉÏÒÑ×°ÖÃncurses¿â¡£Äú¿ÉÒÔʹÓðü¹ÜÀíÆ÷À´×°ÖÃËü £¬ÀýÈçÔÚUbuntuÉÏ £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî×°ÖÃncurses¿â£º

sudo apt-get install libncurses5-dev

µÇ¼ºó¸´ÖÆ

2¡¢°üÀ¨Í·Îļþ£º

ÔÚÄúµÄÔ´´úÂëÎļþÖÐ £¬°üÀ¨ »ò Í·Îļþ¡£

ÀýÈ磺

#include <ncurses.h>

µÇ¼ºó¸´ÖÆ

3¡¢³õʼ»¯ºÍÉèÖãº

ÔÚ³ÌÐò×îÏÈʱ £¬Å²ÓÃinitscr()º¯ÊýÀ´³õʼ»¯ÆÁÄ» £¬²¢Å²ÓÃÆäËûº¯ÊýÀ´ÉèÖÃÖն˵ÄÊôÐÔ £¬ÀýÈçÒþ²Ø¹â±ê¡¢ÆôÓÃÑÕÉ«µÈ¡£

ÀýÈ磺

initscr(); 
// ³õʼ»¯ÆÁÄ»
noecho(); 
// եȡ»ØÏÔÊäÈë×Ö·û
curs_set(0); 
// Òþ²Ø¹â±ê
start_color(); 
// ÆôÓÃÑÕÉ«Ö§³Ö

µÇ¼ºó¸´ÖÆ

4¡¢Ê¹Óùâ±ê¿ØÖƺ¯Êý£º

ʹÓÃÌṩµÄ¹â±ê¿ØÖƺ¯ÊýÀ´Òƶ¯¹â±ê¡¢Êä³öÎı¾µÈ¡£

ÀýÈ磺

mvprintw(10, 10, "Hello, World!"); 
// ÔÚ×ø±ê(10, 10)´¦Êä³öÎı¾
move(5, 5); 
// Òƶ¯¹â±êµ½×ø±ê(5, 5)´¦

µÇ¼ºó¸´ÖÆ

5¡¢ÕûÀíºÍÍ˳ö£º

ÔÚ³ÌÐò¿¢ÊÂʱ £¬Å²ÓÃendwin()º¯ÊýÀ´»Ö¸´Öն˵ÄԭʼÉèÖò¢Í˳ö¡£

ÀýÈ磺

endwin(); 
// »Ö¸´ÖÕ¶ËÉèÖò¢Í˳ö

µÇ¼ºó¸´ÖÆ

Çë×¢ÖØ £¬Ê¹Óà »ò Í·ÎļþÐèÒªÒ»¶¨µÄ±à³Ì֪ʶºÍÃ÷È·¡£Äú¿ÉÒԲο¼ncurses¿âµÄÎĵµºÍʾÀý´úÂëÀ´¸üÉîÈëµØÏàʶÔõÑùʹÓÃÕâЩͷÎļþÀ´¿ØÖƹâ±êºÍÖÕ¶ËÊä³ö¡£

ÒÔÉϾÍÊÇlinuxÏÂÄĸöÍ·ÎļþÊÇ¿ØÖƹâ±êµÄµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ