printf»µÄ¶íÂÞ˹·½¿é(linuxÒì²½I/O,C++)
Õâ¸ö·½¿éÓÎÏ·ÊÇÓÃlinuxÖն˵Ĺâ±ê¿ØÖÆ¡¢ÑÕÉ«ÉèÖÃ×öµÄ
(ÌíÁ˸ö¹¦ÄÜ£¬×ÖĸPÔÝÍ£¡¢»Ö¸´ÓÎÏ·)
Óà A S D W ¿ØÖÆÒƶ¯¡¢×ªÏò£¬¿Õ¸ñ¼üÏÂ×¹µ½µ×£»
linuxµÄÒì²½aioº¯Êý½â¾öÁ˺ܶàÂé·³£»
ÓÃÁ˸ö¼òµ¥µÄÄ£°åµ¥Àýģʽ£¬¼Ì³ÐËü¾Í¿ÉÒÔ£»
¶ÔPOSIXÏ̼߳òµ¥·â×°³ÉjavaÏ߳̽ӿڣ»
#include <memory>
#include "Tetris.h"
#include "TtyAuto.h"
static void instruction()
{
// һЩ˵Ã÷ÐÔÎÄ×Ö
printf("\033[2J");
printf("\033[4;34;47m%s\033[0m", "\t\t\tYou can use the key 'A','S','D','W' to control the block.\n\n\t\t\tPress space key make the block down to bottom.\n\n\t\t\t'P' to pause the game.\n\n");
printf("\033[5;34;41m%s\033[0m", "\t\t\tPRESS ANY KEY TO START GAME...\n\n" );
getchar();
}
int main(int ac, char *av[])
{
std::auto_ptr<TtyAuto> autoAdjustTty(TtyAuto::getInstance());
instruction();
// ÓÎÏ·¿ªÊ¼
Tetris game;
game.start();
game.join();
printf("\r\t\t\t\t\t\r");
return 0;
}
#ifndef BERT_THREAD_H
#define BERT_THREAD_H
#include <pthread.h>
/**
* Ï̷߳â×°£¬½Ó¿ÚÄ£·ÂJAVA
*/
class Runnable
{
public:
virtual ~Runnable() { }
/**
* Ïß³ÌÂß¼ÔÚ´ËʵÏÖ
*/
virtual void run() = 0;
};
class Thread: public Runnable
{
/**
* ±¾Ïß³ÌID
*/
pthread_t m_tid;
/**
* ÊÇ·ñÔÚÔËÐеıêÖ¾
*/
bool running;
/**
* Ï̺߳¯Êý£¬ÄÚ²¿µ÷ÓÃrun
*/
static void * threadFunc(void * arg);
public:
Thread();
~Thread();
/**
* ˯Ãß Ãë
*/
static unsigned int sleep( unsigned int seconds);
/**
* ˯ÃߺÁÃë
*/
static unsigned int msleep( unsigned int mSeconds);
/**
* Æô¶¯Ïß³Ì
*/
bool start() ;
/**
* µÈ´ý±¾Ïß³ÌÔËÐÐÍê
*/
void join() const;
/**
* ÊÇ·ñÔÚÔËÐÐ
*/
bool isAlive() const
{
return running;
Ïà¹ØÎĵµ£º
VirtualBox¹Ù·½ÍøÕ¾£ºhttp://www.virtualbox.org/
ÒÔÏÂΪubuntu Ϊƽ̨µÄ°²×°¡¢ÅäÖá¢Ê¹Óã¬ÆäʵÔÚ¸÷¸ö·¢ÐаæÖеÄʹÓö¼²î²»¶à£¬Ö»ÊÇÔÚÏÂÔØµÄʱºòÐèÒªÏÂÔØÏà¶ÔÓ¦Ö÷ϵͳƽ̨µÄ°²×°°ü¼´¿É¡£
»·¾³ÐèÇó£º
VirtualBoxÐèÒªker ......
Linux¶àÏ̱߳à³Ì¼¼Êõ×ܽá
1
¡¢Ï̵߳Ĵ´½¨¡¢ÖÕÖ¹¼°¿ØÖÆ£º
Èκνø³ÌÔÚÆô¶¯Ê±¾ÍÒÑÓÐÁËÒ»¸öÖ÷Ị̈߳¬Èç¹ûÐèÒªÔÙÉú³ÉÏß³ÌÔòʹÓÃ
pthread_create
º¯Êý£¬Ôڸú¯ÊýÖпÉÒÔÖ¸¶¨Ï̵߳ÄÊôÐÔ¡¢Ïß³ÌÀý³Ì¡¢´«¸øÏß³ÌÀý³ÌµÄ²ÎÊý¡£Ïß³ÌÀý³ÌÊÇÒ»¸öÓû§×Ô¶¨ÒåµÄº¯Êý£¬¼°Ïß³ÌÖ´ÐеĴúÂë¡£µ±Ïß³ÌÀý³Ì· ......
#include <sys/select.h>
#include <sys/time.h>
#include
<sys/types.h>
#include <unistd.h>
int select(int
nfds,fd_set *readfds,fd_set *writefds, fd_set *except fds,struct timeval
*timeout)
void FD_SET(int fd,fd_set *fdset)
void FD_CLR(int fd,fd_set
*fdset)
void F ......
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâÐ©ÍøÕ¾Ìṩc/c++Ô´´úÂë ¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨ Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/&nbs ......
ÏÂÔØµØÖ·£ºhttp://www.fcitx.org/main/?q=node/9
Version-°æ±¾ Update©¤¸üÐÂÈÕÆÚ±¸×¢
fcitx-3.4.tar.bz2
2006-09-21
×îÐÂÎȶ¨°æ
fcitx-060910.tar.bz2
2006-09-10
²âÊÔ°æ
fcitx-3.3.1-bin.tar.bz2
2006-08-30
Îȶ¨°æ(Ô¤±àÒë°üIA32)
Ñ¡Ôñ×îа档¡£
Ô´Âë°üµÄ°²×°£»
[root@localhost beinan]# tar jxvf fci ......