• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FlushConsoleInputBuffer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FlushConsoleInputBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ FlushConsoleInputBuffer函数的具体用法?C++ FlushConsoleInputBuffer怎么用?C++ FlushConsoleInputBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FlushConsoleInputBuffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: noecho_fgets

static int noecho_fgets(char *buf, int size, FILE *tty)
{
    int i;
    char *p;

    p=buf;
    for (;;)
    {
        if (size == 0)
        {
            *p='\0';
            break;
        }
        size--;
#ifdef WIN16TTY
        i=_inchar();
#elif defined(_WIN32)
        i=_getch();
#else
        i=getch();
#endif
        if (i == '\r') i='\n';
        *(p++)=i;
        if (i == '\n')
        {
            *p='\0';
            break;
        }
    }
#ifdef WIN_CONSOLE_BUG
    /* Win95 has several evil console bugs: one of these is that the
     * last character read using getch() is passed to the next read: this is
     * usually a CR so this can be trouble. No STDIO fix seems to work but
     * flushing the console appears to do the trick.
     */
    {
        HANDLE inh;
        inh = GetStdHandle(STD_INPUT_HANDLE);
        FlushConsoleInputBuffer(inh);
    }
#endif
    return(strlen(buf));
}
开发者ID:srinivenkat,项目名称:Parallel_Open_SSL,代码行数:43,代码来源:ui_openssl.c


示例2: wait_for_console_key

/* Read console events until there is a key event.  Also returns on any error. */
static void wait_for_console_key(void)
{
	HANDLE hConsoleInput = GetStdHandle(STD_INPUT_HANDLE);

	if (!ELEM(hConsoleInput, NULL, INVALID_HANDLE_VALUE) && FlushConsoleInputBuffer(hConsoleInput)) {
		for (;;) {
			INPUT_RECORD buffer;
			DWORD ignored;

			if (!ReadConsoleInput(hConsoleInput, &buffer, 1, &ignored)) {
				break;
			}

			if (buffer.EventType == KEY_EVENT) {
				break;
			}
		}
	}
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:20,代码来源:wm_init_exit.c


示例3: while

void BaseApp::Run()
{
	CStopwatch timer;
	int sum = 0;
	int counter = 0;

	int deltaTime = 0;
	while (1)
	{
		timer.Start();
		if (kbhit())
		{
			KeyPressed (getch());
			if (!FlushConsoleInputBuffer(mConsoleIn))
				cout<<"FlushConsoleInputBuffer failed with error "<<GetLastError();
		}

		UpdateF((float)deltaTime / 1000.0f);
		Render();
		Sleep(1);

		while (1)
		{
			deltaTime = timer.Now();
			if (deltaTime > 20)
				break;
		}

		sum += deltaTime;
		counter++;
		if (sum >= 1000)
		{
			TCHAR  szbuff[255];
			StringCchPrintf(szbuff, 255, TEXT("FPS: %d"), counter);
			SetConsoleTitle(szbuff);

			counter = 0;
			sum = 0;
		}
	}
}
开发者ID:ShartepStudy,项目名称:LUXOFT,代码行数:41,代码来源:BaseApp.cpp


示例4: sprintf

void CMap::CheckForNpc(int x, int y)
{
	// Go through all of the npcs and see if we have a match for the position
	for(int i = 0; i < (int)m_vNpcs.size(); i++)
	{
		CNpc *pNpc= &m_vNpcs[i];

		// Check if this npc has the same position as the position passed in
		if(x == pNpc->GetIndex().X && y == pNpc->GetIndex().Y)
		{
			// Move the player back so they aren't on the NPC
			g_Player.MovePlayerBack();


//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////

			// Since we have cut scenes and eventual shop keepers, we first check
			// to see if there is any action key assigned with the npc before we
			// let them speak.  If they do, we want to use that dialog and not
			// the standard dialog that they would spit out.  Like Jax's case.
			if(pNpc->GetActionKey())
			{
				// Handle the action key and return
				g_ActionKeys.HandleKey(pNpc->GetActionKey(), pNpc);
				return;
			}

//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////


			// Display the NPC message, pause, then clear the input buffer and wait for a key
			char szDialog[5000] = {0};
			sprintf(szDialog, "%s: %s", pNpc->GetName(), pNpc->GetMessage());
			DisplayDialog(szDialog);
			Sleep(1000);
			FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
			getch();
			break;
		}
	}
}
开发者ID:88er,项目名称:tutorials,代码行数:41,代码来源:Map.cpp


示例5: CON_Init

/*
==================
CON_Init
==================
*/
void CON_Init( void )
{
	CONSOLE_SCREEN_BUFFER_INFO info;
	char consoleTitle[128];
	int i;

	// handle Ctrl-C or other console termination
	SetConsoleCtrlHandler( CON_CtrlHandler, TRUE );

	qconsole_hin = GetStdHandle( STD_INPUT_HANDLE );
	if( qconsole_hin == INVALID_HANDLE_VALUE )
		return;

	qconsole_hout = GetStdHandle( STD_OUTPUT_HANDLE );
	if( qconsole_hout == INVALID_HANDLE_VALUE )
		return;

	GetConsoleMode( qconsole_hin, &qconsole_orig_mode );

	// allow mouse wheel scrolling
	SetConsoleMode( qconsole_hin,
		qconsole_orig_mode & ~ENABLE_MOUSE_INPUT );

	FlushConsoleInputBuffer( qconsole_hin ); 

	GetConsoleScreenBufferInfo( qconsole_hout, &info );
	qconsole_attrib = info.wAttributes;
	qconsole_backgroundAttrib = qconsole_attrib & (BACKGROUND_BLUE|BACKGROUND_GREEN|BACKGROUND_RED|BACKGROUND_INTENSITY);

	// ZTM: FIXME: com_productName isn't initialized or set to game title yet.
	Com_sprintf( consoleTitle, sizeof (consoleTitle), "%s Dedicated Server Console", com_productName ? com_productName->string : PRODUCT_NAME );
	SetConsoleTitle( consoleTitle );

	// initialize history
	for( i = 0; i < QCONSOLE_HISTORY; i++ )
		qconsole_history[ i ][ 0 ] = '\0';

	// set text color to white
	SetConsoleTextAttribute( qconsole_hout, CON_ColorCharToAttrib( COLOR_WHITE ) );
}
开发者ID:mecwerks,项目名称:spearmint,代码行数:45,代码来源:con_win32.c


示例6: input_waiting

bool input_waiting()
{
#ifndef WIN32
    fd_set readfds;
    struct timeval tv;
    FD_ZERO(&readfds);
    FD_SET(fileno(stdin), &readfds);
    tv.tv_sec = 0;
    tv.tv_usec = 0;
    select(16, &readfds, nullptr, nullptr, &tv);

    return (FD_ISSET(fileno(stdin), &readfds));
#else
    static int init = 0, pipe;
    static HANDLE inh;
    DWORD dw;

    if(!init)
    {
        init = 1;
        inh = GetStdHandle(STD_INPUT_HANDLE);
        pipe = !GetConsoleMode(inh, &dw);
        if(!pipe)
        {
            SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT));
            FlushConsoleInputBuffer(inh);
        }
    }
    if(pipe)
    {
        if(!PeekNamedPipe(inh, NULL, 0, NULL, &dw, NULL)) return 1;
        return dw;
    }
    else
    {
        GetNumberOfConsoleInputEvents(inh, &dw);
        return dw <= 1 ? 0 : dw;
    }
#endif // WIN32
}
开发者ID:ServerTech,项目名称:cortex,代码行数:40,代码来源:misc.cpp


示例7: CON_Init

/*
==================
CON_Init
==================
*/
void CON_Init( void )
{
	CONSOLE_CURSOR_INFO curs;
	CONSOLE_SCREEN_BUFFER_INFO info;
	int i;

	// handle Ctrl-C or other console termination
	SetConsoleCtrlHandler( CON_CtrlHandler, TRUE );

	qconsole_hin = GetStdHandle( STD_INPUT_HANDLE );
	if( qconsole_hin == INVALID_HANDLE_VALUE )
		return;

	qconsole_hout = GetStdHandle( STD_OUTPUT_HANDLE );
	if( qconsole_hout == INVALID_HANDLE_VALUE )
		return;

	GetConsoleMode( qconsole_hin, &qconsole_orig_mode );

	// allow mouse wheel scrolling
	SetConsoleMode( qconsole_hin,
		qconsole_orig_mode & ~ENABLE_MOUSE_INPUT );

	FlushConsoleInputBuffer( qconsole_hin ); 

	GetConsoleScreenBufferInfo( qconsole_hout, &info );
	qconsole_attrib = info.wAttributes;

	SetConsoleTitle("ioquake3 Dedicated Server Console");

	// make cursor invisible
	GetConsoleCursorInfo( qconsole_hout, &qconsole_orig_cursorinfo );
	curs.dwSize = 1;
	curs.bVisible = FALSE;
	SetConsoleCursorInfo( qconsole_hout, &curs );

	// initialize history
	for( i = 0; i < QCONSOLE_HISTORY; i++ )
		qconsole_history[ i ][ 0 ] = '\0';
}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:45,代码来源:con_win32.c


示例8: getKey

int getKey()
{
	int key; DWORD cNumRead; INPUT_RECORD irInBuf;
	HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);

	do
	{
		FlushConsoleInputBuffer(hStdIn);
		do
		{
			ReadConsoleInput(hStdIn, &irInBuf, 1, &cNumRead);
		} while (irInBuf.EventType != KEY_EVENT || irInBuf.Event.KeyEvent.bKeyDown);
		if (irInBuf.Event.KeyEvent.uChar.AsciiChar == 0)
		{
			key = irInBuf.Event.KeyEvent.wVirtualKeyCode;
		}
		else key = irInBuf.Event.KeyEvent.uChar.AsciiChar;
	} while (key != ESCAPE && key != LEFT && key != UP
		&& key != RIGHT  && key != DOWN && key != ENTER);

	return key;
}
开发者ID:vigonz06,项目名称:Correo,代码行数:22,代码来源:utilsWin.cpp


示例9: GetStdInputHandle

void FileTests::TestReadFileLine()
{
    HANDLE const hIn = GetStdInputHandle();
    VERIFY_IS_NOT_NULL(hIn, L"Verify we have the standard input handle.");

    DWORD dwMode = ENABLE_LINE_INPUT;
    VERIFY_WIN32_BOOL_SUCCEEDED(SetConsoleMode(hIn, dwMode), L"Set input mode for test.");

    VERIFY_WIN32_BOOL_SUCCEEDED(FlushConsoleInputBuffer(hIn), L"Flush input buffer in preparation for test.");

    char ch = '\0';
    Log::Comment(L"Queue background blocking read file operation.");
    auto BackgroundRead = std::async([&] {
        DWORD dwRead = 0;
        VERIFY_WIN32_BOOL_SUCCEEDED(ReadFile(hIn, &ch, 1, &dwRead, nullptr), L"Read file was successful.");
        VERIFY_ARE_EQUAL(1u, dwRead, L"Verify we read 1 character.");
    });

    char const chExpected = 'a';
    Log::Comment(L"Send a key into the console.");
    SendFullKeyStrokeHelper(hIn, chExpected);

    auto status = BackgroundRead.wait_for(std::chrono::milliseconds(250));
    VERIFY_ARE_EQUAL(std::future_status::timeout, status, L"We should still be waiting for a result.");
    VERIFY_ARE_EQUAL('\0', ch, L"Character shouldn't be filled by background read yet.");

    Log::Comment(L"Send a line feed character, we should stay blocked.");
    SendFullKeyStrokeHelper(hIn, '\n');
    status = BackgroundRead.wait_for(std::chrono::milliseconds(250));
    VERIFY_ARE_EQUAL(std::future_status::timeout, status, L"We should still be waiting for a result.");
    VERIFY_ARE_EQUAL('\0', ch, L"Character shouldn't be filled by background read yet.");

    Log::Comment(L"Now send a carriage return into the console to signify the end of the input line.");
    SendFullKeyStrokeHelper(hIn, '\r');

    Log::Comment(L"Wait for background thread to unblock.");
    BackgroundRead.wait();
    VERIFY_ARE_EQUAL(chExpected, ch);
}
开发者ID:ShipRekt101,项目名称:terminal,代码行数:39,代码来源:API_FileTests.cpp


示例10: initializeWorld

void initializeWorld(){
	hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	FlushConsoleInputBuffer(hConsole);	
	
	drawTable();
	
	rotatingBar(WIDTH/2, HEIGHT/2, 0);
	
	gotoxy(0,0);
	SetConsoleTextAttribute(hConsole, colors[0]);
	printf("O");
	SetConsoleTextAttribute(hConsole, colors[1]);
	gotoxy(WIDTH,0);
	printf("O");
	SetConsoleTextAttribute(hConsole, colors[2]);
	gotoxy(WIDTH,HEIGHT);
	printf("O");
	SetConsoleTextAttribute(hConsole, colors[3]);
	gotoxy(0,HEIGHT);
	printf("O");
	
}
开发者ID:felipeViana,项目名称:Tron,代码行数:22,代码来源:initialize.cpp


示例11: __declspec

void __declspec(noreturn) exit()
{
//   EnableMenuItem(GetSystemMenu(GetConsoleWindow(), FALSE), SC_CLOSE, MF_ENABLED);
   exitflag = 1;
   if (savesndtype)
       savesnddialog();
   if (videosaver_state)
     main_savevideo();  // stop saving video

   if (!normal_exit)
       done_fdd(false);
   done_tape();
   done_dx();
   done_gs();
   done_leds();
   save_nv();
   zf232.rs_close();
   zf232.zf_close();
   done_ie_help();
   done_bpx();
   GdiplusShutdown();

//   timeEndPeriod(1);
   if (ay[1].Chip2203) YM2203Shutdown(ay[1].Chip2203); //Dexus
   if (ay[0].Chip2203) YM2203Shutdown(ay[0].Chip2203); //Dexus
   if (comp.ts.vdac2) vdac2::close_ft8xx();

   color();
   printf("\nsee you later!\n");
   if (!nowait)
   {
       SetConsoleTitle("press a key...");
       FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
       getch();
   }
   fflush(stdout);
   SetConsoleCtrlHandler(ConsoleHandler, FALSE);
   exit(0);
}
开发者ID:tslabs,项目名称:zx-evo,代码行数:39,代码来源:init.cpp


示例12: tty_getchar

int tty_getchar()
{
  HANDLE stdinHandle = GetStdHandle (STD_INPUT_HANDLE);

  DWORD rc = WaitForSingleObject (stdinHandle, 1000);

  if (rc == WAIT_TIMEOUT)   return  0;
  if (rc == WAIT_ABANDONED) return -1;
  if (rc == WAIT_FAILED)    return -1;

  // The whole ReadConsoleInput () part is a workaround.
  // For some unknown reason, maybe a mingw bug, a random signal
  // is sent to stdin which unblocks WaitForSingleObject () and sets rc 0.
  // Then it wants to read with getche () a keyboard input
  // which has never been made.

  INPUT_RECORD buf[100];

  DWORD num = 0;

  memset (buf, 0, sizeof (buf));

  ReadConsoleInput (stdinHandle, buf, 100, &num);

  FlushConsoleInputBuffer (stdinHandle);

  for (DWORD i = 0; i < num; i++)
  {
    if (buf[i].EventType != KEY_EVENT) continue;

    KEY_EVENT_RECORD KeyEvent = buf[i].Event.KeyEvent;

    if (KeyEvent.bKeyDown != TRUE) continue;

    return KeyEvent.uChar.AsciiChar;
  }

  return 0;
}
开发者ID:ghostyguo,项目名称:hashcat,代码行数:39,代码来源:terminal.c


示例13: r_cons_readchar

R_API int r_cons_readchar() {
    char buf[2];
    buf[0] = -1;
#if __WINDOWS__ && !__CYGWIN__ && !MINGW32
    BOOL ret;
    DWORD out;
    DWORD mode;
    char b;
    HANDLE h = GetStdHandle (STD_INPUT_HANDLE);
    GetConsoleMode (h, &mode);
    SetConsoleMode (h, 0); // RAW
ignore:
    if (!I->is_wine) {
        while (!_kbhit ());
        b = getwinkey ();
        if (b=='2')
            goto ignore;
        else if (b=='1')
            ret = ReadConsole (h, buf, 1, &out, NULL);
        else {
            buf[0]=b;
            ret=1;
        }
    } else {
        ret = ReadConsole (h, buf, 1, &out, NULL);
    }
    FlushConsoleInputBuffer(h);
    if (!ret)
        return -1;
    SetConsoleMode (h, mode);
#else
    r_cons_set_raw (1);
    if (read (0, buf, 1)==-1)
        return -1;
    r_cons_set_raw (0);
#endif
    return r_cons_controlz (buf[0]);
}
开发者ID:jasmorton,项目名称:radare2,代码行数:38,代码来源:input.c


示例14: FlushConsoleInputBuffer

bool KConsoleDriver::readKeyExtended(char *out,bool *pressing,int *repeatCount)
{
#ifdef USE_M_API
	INPUT_RECORD inrec;
	dword count;

	FlushConsoleInputBuffer( hStdIn );
	ReadConsoleInput( hStdIn, &inrec, 1, &count );

	if (count > 0)
	{
		if (inrec.EventType == KEY_EVENT)
		{
			*out = inrec.Event.KeyEvent.uChar.AsciiChar;
			*pressing = inrec.Event.KeyEvent.bKeyDown != 0;
			*repeatCount = (int)inrec.Event.KeyEvent.wRepeatCount;
			return true;
		}
	}
#endif
	*out = 0;
	return false;
}
开发者ID:LeDYoM,项目名称:kaste,代码行数:23,代码来源:KConsoleDriver.cpp


示例15: GetStdHandle

void CConsole::initconsole()
{
  conin =  GetStdHandle(STD_INPUT_HANDLE);
  conout = GetStdHandle(STD_OUTPUT_HANDLE);

  ZeroMemory(&ovc,sizeof(ovc));
  ovc.hEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
  if(ovc.hEvent == INVALID_HANDLE_VALUE) {
     throw errors("CreateEvent error");
  }

  SetConsoleMode(conin,ENABLE_MOUSE_INPUT);
  GetConsoleScreenBufferInfo(conout,&csb);
  if (csb.dwSize.X<80||csb.dwSize.Y<25){
     CloseHandle(ovc.hEvent);
     throw errors("console size is too small");
  }
  FlushConsoleInputBuffer(conin);
  head=tail=0;
  cci.bVisible=0;cci.dwSize=10;
  SetConsoleCursorInfo(conout,&cci);
  SetConsoleTitle(jmail);
}
开发者ID:inspirer,项目名称:history,代码行数:23,代码来源:console.cpp


示例16: open_console

void open_console()
{
	BYTE Title[200]; 
	BYTE ClassName[200]; 
	LPTSTR  lpClassName=ClassName; 
	HANDLE hConWnd; 
	FILE *hf;
	static BYTE consolecreated=FALSE;
	static int hCrt=0;
	
	if(consolecreated==TRUE)
	{

		GetConsoleTitle(Title,sizeof(Title));
		hConWnd=FindWindow(NULL,Title);
		GetClassName(hConWnd,lpClassName,120);
		ShowWindow(hConWnd,SW_SHOW);
		SetForegroundWindow(hConWnd);
		hConWnd=GetStdHandle(STD_INPUT_HANDLE);
		FlushConsoleInputBuffer(hConWnd);
		return;
	}
	AllocConsole(); 
	hCrt=_open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT);

	fflush(stdin);
	hf=_fdopen(hCrt,"w"); 
	*stdout=*hf; 
	setvbuf(stdout,NULL,_IONBF,0);

	GetConsoleTitle(Title,sizeof(Title));
	hConWnd=FindWindow(NULL,Title);
	GetClassName(hConWnd,lpClassName,120);
	ShowWindow(hConWnd,SW_SHOW); 
	SetForegroundWindow(hConWnd);
	consolecreated=TRUE;
}
开发者ID:pinchyCZN,项目名称:BMView,代码行数:37,代码来源:BMView.c


示例17: FlushConsoleInputBuffer

void EventHandle::PollInput() // Grabs input from 'GetAsyncKeyState()'
{
	int i = 0;
	FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));

	if (GetAsyncKeyState(VK_LEFT) & 0x8000) { m_vKeys.push_back(VK_LEFT); ++i; }
	if (GetAsyncKeyState(VK_RIGHT) & 0x8000) { m_vKeys.push_back(VK_RIGHT); ++i; }
	if (GetAsyncKeyState(VK_UP) & 0x8000) { m_vKeys.push_back(VK_UP); ++i; }
	if (GetAsyncKeyState(VK_DOWN) & 0x8000) { m_vKeys.push_back(VK_DOWN);  ++i; }

	if (GetAsyncKeyState('W') & 0x8000)	{ m_vKeys.push_back(0x57);  ++i; } // W Key
	if (GetAsyncKeyState('A') & 0x8000) { m_vKeys.push_back(0x41);  ++i; } // A Key
	if (GetAsyncKeyState('S') & 0x8000) { m_vKeys.push_back(0x53);  ++i; } // S Key
	if (GetAsyncKeyState('D') & 0x8000) { m_vKeys.push_back(0x44);  ++i; } // D Key

	if (GetAsyncKeyState('P') & 0x8000) { m_vKeys.push_back(0x50);  ++i; } // P Key
	if (GetAsyncKeyState('G') & 0x8000) { m_vKeys.push_back(0x47);  ++i; } // G Key
	if (GetAsyncKeyState('X') & 0x8000) { m_vKeys.push_back(0x58);  ++i; } // X Key

	if (GetAsyncKeyState('F') & 0x8000) { m_vKeys.push_back(0x46);  ++i; } // F Key

	if (GetAsyncKeyState(VK_RETURN) & 0x8000) { m_vKeys.push_back(VK_RETURN);  ++i; }

	if (GetAsyncKeyState(VK_PRIOR) & 0x8000) { m_vKeys.push_back(VK_PRIOR); ++i; }
	if (GetAsyncKeyState(VK_NEXT) & 0x8000) { m_vKeys.push_back(VK_NEXT); ++i; }

	if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) { m_vKeys.push_back(VK_ESCAPE); ++i; }

	OrderInput();
	ParseInput();
	if (!i)
	{
		m_vPrevKeys.clear();
		m_vUntilPressed.clear();
		m_vUntilRepeat.clear();
	}
}
开发者ID:bennybroseph,项目名称:Assesments,代码行数:37,代码来源:EventHandle.cpp


示例18: InputAvailable

int InputAvailable(void) {

#if defined(_WIN32) || defined(_WIN64)
  static int init = 0, pipe;
  static HANDLE inh;
  DWORD dw;

  if (!init) {
    init = 1;
    inh = GetStdHandle(STD_INPUT_HANDLE);
    pipe = !GetConsoleMode(inh, &dw);
    if (!pipe) {
      SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
      FlushConsoleInputBuffer(inh);
    }
  }
  if (pipe) {
    if (!PeekNamedPipe(inh, NULL, 0, NULL, &dw, NULL))
      return 1;
    return dw > 0;
  } else {
    GetNumberOfConsoleInputEvents(inh, &dw);
    return dw > 1;
  }
#else
  fd_set readfds;
  struct timeval tv;

  FD_ZERO(&readfds);
  FD_SET(STDIN_FILENO, &readfds);
  tv.tv_sec = 0;
  tv.tv_usec = 0;
  select(STDIN_FILENO + 1, &readfds, NULL, NULL, &tv);
  return FD_ISSET(STDIN_FILENO, &readfds);
#endif
}
开发者ID:raimarHD,项目名称:lcec,代码行数:36,代码来源:util.cpp


示例19: additem

void additem()
{
	fclose(fsal);
	int b;
	FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
	sal1.id=0;
	sal1.price=0;
	sal1.quan=0;
	int id;
	gtc(45,13);printf("Input Item ID: ");scanf("%d",&id);
	fi1=fopen("mainInv.data","rb+");
	while(fread(&inv1,sizeof(inv1),1,fi1)==1)
	{
	if (cID(id)==0)
	{
		gtc(45,14);printf("Item Matched! \(%s)",inv1.pName);
		gtc(45,15);printf("Input Quantity: ");scanf("%d",&sal1.quan);
		for(int a=0;a<=6;a++)
		{
			sal1.name[a]=inv1.pName[a];
		}
		srand(time(NULL));
		b=rand()%100+1;
		sal1.id=inv1.itemID+b;
		sal1.totalquan+=sal1.quan;	
		sal1.price=inv1.price*sal1.quan;
		sal1.total+=sal1.price;
		fsal=fopen("tempsales.data","ab+");
		fseek(fsal,0,SEEK_END);
		fwrite(&sal1,sizeof(sal1),1,fsal);
		fclose(fsal);
		gtc(45,16);printf("Added %d of %s",sal1.quan,inv1.pName);	getch();			
		sales();exit(0);
	}
	else
	{
开发者ID:jrvmbust,项目名称:ite-001,代码行数:36,代码来源:fp_CSDPoS.cpp


示例20: consoleFlushInput

BOOL
consoleFlushInput (
    void
    )
/*++

Routine Description:

    Flushes input events.

Arguments:

    None.

Return Value:

    TRUE if success, FALSE otherwise

--*/
{
    EventBuffer.NumberOfEvents = 0;

    return FlushConsoleInputBuffer( hInput );
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:24,代码来源:console.c



注:本文中的FlushConsoleInputBuffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FlushFileBuffers函数代码示例发布时间:2022-05-30
下一篇:
C++ FlushCache函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap