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 ......
ÁËCÈ»ºóC++£¬È»ºóMFC/Windows,È»ºóÊÇC#,ÆäÖÐÊý¾ÝÀàÐͺܶ࣬ÓÉ»ù±¾ÀàÐÍÑÜÉúµÄtypedefÀàÐÍÒ²N¶à¡£ÊìÖª»ù±¾Êý¾ÝÀàÐÍÊÇÎÒÃÇÕýÈ·±í´ïʵ¼ÊÎÊÌâÖи÷ÖÖÊý¾ÝµÄǰÌᣬÒò´ËÎÒ·ÖÀà×ܽáÁËÒ»ÏÂC/C++/Windows /C#»ù±¾Êý¾ÝÀàÐÍ£¬ÒÔ±ãÈÕºó²éÔÄ¡£
ANSI C/C++»ù±¾Êý¾ÝÀàÐÍ£º
Type
Size
Ê ......
EthtoolÊÇÓÃÓÚ²éѯ¼°ÉèÖÃÍø¿¨²ÎÊýµÄÃüÁî¡£
¸ÅÒª£º
ethtool ethX //²éѯethXÍø¿Ú»ù±¾ÉèÖÃ
ethtool –h //ÏÔʾethtoolµÄÃüÁî°ïÖú(help)
ethtool –i ethX //²éѯethXÍø¿ÚµÄÏà¹ØÐÅÏ¢
ethtool –d ethX  ......
ÔÚmenUConfigÖÐÅäÖ㬿ÉÒÔ¶Ô½øÐÐLinuxÄÚºËÅäÖÃÑ¡Ïɾ¸Ä¡£±¾ÎĽéÉÜÏêϸÅäÖ÷½·¨¡£
µÚÒ»²¿·Ö£ºÈ«²¿É¾³ý
¡¡¡¡Code maturity level options ---> ´úÂë³ÉÊìµÈ¼¶Ñ¡Ïî
¡¡¡¡[]Prompt for development and/or incomplete code/drivers ĬÈÏÇé¿öÏÂÊÇÑ¡ÔñµÄ£¬Õ⽫»áÔÚÉèÖýçÃæÖÐÏÔʾ»¹ÔÚ¿ª·¢»òÕß»¹Ã»ÓÐÍê³ÉµÄ´úÂëÓëÇý¶¯.²»Ñ¡¡£ ......
µÚÊ®¶þ²¿·Ö: È«²¿É¾³ý
¡¡¡¡Instrumentation support
µÚÊ®Èý²¿·Ö£ºÈ«²¿É¾³ý
¡¡¡¡Kernel hacking --->ÆÆ½âºËÐÄ£¿¿É²»Êǵ±º¡¿ÍÀ²£¬²»Ñ¡
µÚÊ®ËIJ¿·Ö£ºÈ«²¿É¾³ý
¡¡¡¡Security options --->
µÚÊ®Î岿·Ö£ºÈ«²¿É¾³ý
¡¡¡¡Cryptographic options --->ÕâÊǺËÐÄÖ§³Ö¼ÓÃܵÄÑ¡Ïî
µÚÊ®Áù²¿·Ö£ºÈ«²¿É¾³ý
¡¡¡¡Library rout ......