当前位置: 首页>>代码示例>>C++>>正文


C++ cgetc函数代码示例

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


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

示例1: cbm_input

unsigned char* cbm_input(unsigned char len,unsigned char cursor){
	unsigned char key=0;
	unsigned char* eingabestring=calloc(len,1);
	unsigned char eglen;

	if(NULL!=eingabestring){
		if(kbhit()){cgetc();}
		while(('\n'!=key)){
			eglen=strlen(eingabestring);
			putchar(cursor);
			key=cgetc();
			switch(key){
				case CH_DEL:{
					if(0<eglen){
						eingabestring[eglen-1]='\0';
						putchar(CH_DEL);
						break;
					}
				}
				case CH_ENTER:{break;}
				default:{
					if(len>eglen){
						eingabestring[eglen]=key;
						putchar(key);
					}
				}
			}
		}
		putchar(' ');
		/*clrscr();
		write_room_info();
		write_death();*/
	}
	return eingabestring;
}
开发者ID:An-S,项目名称:MCLib,代码行数:35,代码来源:cbm_input+(2).c

示例2: cgeti

uint16_t cgeti(CFILE *f)
{
   uint16_t a, b;
	a = cgetc(f);
	b = cgetc(f);
	return (b << 8) | (a);
}
开发者ID:Angluca,项目名称:nxengine-libretro,代码行数:7,代码来源:cachefiles.cpp

示例3: main

int main(void)
{
	char c;
        NEWLINE;

        cursor (1);
	PRINTF("enter key (cursor on): ");
	c = cgetc();
        NEWLINE;

        cursor (0);
	PRINTF("enter key (cursor off): ");
	c = cgetc();
        NEWLINE;

	PRINTF("enter key (cursor on): ");
        cursor (1);
	c = cgetc();
        NEWLINE;

	PRINTF("enter key (cursor off): ");
        cursor (0);
	c = cgetc();
        NEWLINE;

        PRINTF("hit any key to exit...");
        c = cgetc();
        NEWLINE;

	return(0);
}
开发者ID:Aliandrana,项目名称:snesdev,代码行数:31,代码来源:cursor.c

示例4: cgetl

uint32_t cgetl(CFILE *f)
{
   uint32_t a, b, c, d;
	a = cgetc(f);
	b = cgetc(f);
	c = cgetc(f);
	d = cgetc(f);
	return (d << 24) | (c << 16) | (b << 8) | (a);
}
开发者ID:Angluca,项目名称:nxengine-libretro,代码行数:9,代码来源:cachefiles.cpp

示例5: loadGame

bool loadGame(tUpdatePosCallback callback)
{
    bool isValid = false;
    bool result = false;
    FILE *saveFile= fopen(SAVE_GAME_FILE, "rb");
    
    if (saveFile == NULL) {
#ifdef LOAD_GAME_DEBUG
        printf("Cannot open save game file\n");
        cgetc();
#endif
        return false;
    }
    
    if ((fread(&isValid, sizeof(isValid), 1, saveFile) != 1) ||
        (!isValid)) {
        fclose(saveFile);
#ifdef LOAD_GAME_DEBUG
        printf("Save is not valid\n");
        cgetc();
#endif
        return false;
    }
    
    if (fread(&theGame, sizeof(theGame), 1, saveFile) != 1) {
        fclose(saveFile);
        deleteGame();
#ifdef LOAD_GAME_DEBUG
        printf("Unable to read game from save\n");
        cgetc();
#endif
        return false;
    }
    
    theGame.callback = callback;
    
    // The saved start time is an elapsed time.  Convert it back into a start time relative to now.
    if (theGame.startTime != 0xffffffff) {
        theGame.startTime = _systime() - theGame.startTime;
    }
    
    theGame.puzzle = loadPuzzle(saveFile);
    
    fclose(saveFile);
    deleteGame();
    
    if (theGame.puzzle == NULL) {
#ifdef LOAD_GAME_DEBUG
        printf("Unable to read puzzle from save\n");
        cgetc();
#endif
        return false;
    }
    
    return true;
}
开发者ID:jeremysrand,项目名称:a2sudoku,代码行数:56,代码来源:game.c

示例6: main

int main (void)
{
	static byte rowNumber, columnNumber, synthesizing;
	static byte rowBit, columnBits, lastColumnBits[8], changedColumnBits;

     /* If we have a character, remove it from the buffer */
    if (kbhit ()) {
       	cgetc ();
    }

	resetSound();
    setUpScreen();
	synthesizing=TRUE;

    //main loop
    while(synthesizing)
    {
		//do keyboard scan
		for (rowNumber = 0; rowNumber <= KeyRows-1; rowNumber++)
		{
			rowBit = 1 << rowNumber;
			
			CIA1.pra = ~rowBit; 		//write the row we want to read
			columnBits = ~CIA1.prb;   	//read the keys pressed in the row
									
			if (lastColumnBits[rowNumber] != columnBits)
			{
				changedColumnBits=lastColumnBits[rowNumber]^columnBits;
				lastColumnBits[rowNumber]=columnBits;
				
				for(columnNumber = 0; 
					columnNumber<= KeyColumns-1 && changedColumnBits != 0; 
					columnNumber++)
				{
					if(changedColumnBits & 1)
					{
						changeFunctionStatus(functionMatrix[rowNumber][columnNumber], 
											columnBits & 1);
					}
					changedColumnBits >>= 1;
					columnBits >>= 1;
				}				
			}
		}

		if(kbhit()){
			if (cgetc()==13)
				synthesizing=FALSE;
		}
    }
开发者ID:seanbutnotheard,项目名称:csynth,代码行数:50,代码来源:csynth.c

示例7: main_menu

char * main_menu ()
{
    bool valid;

    cursor(true);
    for (;;)
    {
        MENU("Dir / ");
        MENU("Load / ");
        MENU("Input ? ");
        valid = false;

        while (!valid)
        {
            switch (toupper (cgetc ()))
            {
            case 'D':
                valid = true;
                printf ("D\r\n\r\n");
                dir ();
                printf ("\r\n");
                break;
            case 'L':
                puts ("L\r\n");
                printf ("Filename? ");
                gets(filename);
                puts ("\r\n");
                return filename;
            case 'I':
                printf ("I\r\n\r\n");
                return 0;
            }
        }
    }
}
开发者ID:gergoerdi,项目名称:brainfuck64,代码行数:35,代码来源:menu.c

示例8: process_checkbox

void process_checkbox(tgui_Window *win, tgui_Obj *obj){
int x, y;
char key;

    x=win->x1 + 1 + obj->x;
    y=win->y1 + 2 + obj->y;

	gotoxy(x+1,y);
	cursor(1);
	revers(1);
	if (obj->state==0) cputc(' ');
	else cputc('X');

	do {
		gotoxy(x+1,y);
	    revers(1);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	    gotoxy(x+1, y);
	    key=cgetc();

	    if (key==' ') {
	        if(obj->state == 0 ) obj->state =1;
			else obj->state = 0;
		}

	} while (key != CH_ENTER);

		gotoxy(x+1,y);
	    revers(0);
	    if (obj->state==0) cputc(' ');
	    else cputc('X');
	cursor(0);

}  // process_checkbox
开发者ID:hculpan,项目名称:kbase,代码行数:35,代码来源:tuilibap.c

示例9: main

void main (void)
{
    log ("Calling overlay 1 from main");

    /* The symbols _OVERLAY1_LOAD__ and _OVERLAY1_SIZE__ were generated by the
     * linker. They contain the overlay area address and size specific to a
     * certain program.
     */
    if (loadfile ("ovrldemo.1", _OVERLAY1_LOAD__, _OVERLAY1_SIZE__)) {

        /* The linker makes sure that the call to foo() ends up at the right mem
         * addr. However it's up to user to make sure that the - right - overlay
         * is actually loaded before making the the call.
         */
        foo ();
    }

    log ("Calling overlay 2 from main");

    /* Replacing one overlay with another one can only happen from the main
     * program. This implies that an overlay can never load another overlay.
     */
    if (loadfile ("ovrldemo.2", _OVERLAY2_LOAD__, _OVERLAY2_SIZE__)) {
        bar ();
    }

    log ("Calling overlay 3 from main");
    if (loadfile ("ovrldemo.3", _OVERLAY3_LOAD__, _OVERLAY3_SIZE__)) {
        foobar ();
    }

    cgetc ();
}
开发者ID:PanchoManera,项目名称:cc65,代码行数:33,代码来源:overlaydemo.c

示例10: GetKeyUpdate

static char GetKeyUpdate (void)
/* Wait for a key updating the windows in the background */
{
    static unsigned char Win;

    /* While there are no keys... */
    while (!kbhit ()) {

        switch (Win) {

            case 0:
                UpdateAsm ();
                break;

            case 1:
                UpdateStack ();
                break;

            case 2:
                UpdateCStack ();
                break;

            case 3:
                UpdateDump ();
                break;
        }

        Win = (Win + 1) & 0x03;

    }

    /* We have a key - return it */
    return cgetc ();
}
开发者ID:AntiheroSoftware,项目名称:cc65,代码行数:34,代码来源:dbg.c

示例11: refreshLevel

static void refreshLevel(tLevel level)
{
    bool waiting = true;
    
    videomode(VIDEOMODE_80x24);
    mixedTextMode();
    speakLevelComplete();
    
    gotoxy(0, 0);
    cprintf(      "               Completed level %u!!", level);
    cputsxy(0, 2, "               Press space to continue to the next level...");
    
    while (waiting) {
        switch (cgetc()) {
            case ' ':
                waiting = false;
                break;
                
            default:
                badThingHappened();
                break;
        }
    }
    
    showAndClearDblLoRes();
    speakGetReady();
}
开发者ID:jeremysrand,项目名称:a2bejwld,代码行数:27,代码来源:ui.c

示例12: display_control_line

uint8_t display_control_line(uint8_t line_count)
{
    char c;

    revers(true);
    cputs("--More--");
    revers(false);
    c = tolower(cgetc());
    erase_backward(8);
    switch (c) {
        case 'b':
            /* Go back one page.*/
            break;
        case ' ':
            /* Print the next page.*/
            line_count = 0;
            break;
        case 'q':
            /* Quit.*/
            exit(EXIT_SUCCESS);
        case CARRIAGE_RETURN:
            /* Display one more line. */
            line_count -= 1;
            break;
    }
    return line_count;
}
开发者ID:gungwald,项目名称:posix-6502,代码行数:27,代码来源:more.c

示例13: save_anim

static void save_anim() {
    switch_to_console_screen();
    if (prompt_open("save", CBM_WRITE, TYPE_USR)) {
        const char curr_screen_saved = curr_screen;

        const char version = 3;
        mycbm_write(MY_LFN, &version, 1);  // Version.
        ++end_frame;
        mycbm_write(MY_LFN, &end_frame, 1);  // Frame count.
        --end_frame;

        for (curr_screen = 0; curr_screen <= end_frame; ++curr_screen) {
            lz77_write_screen();
        }
        curr_screen = curr_screen_saved;

        mycbm_close(MY_LFN);
        if (_oserror) {
            textcolor(COLOR_RED);
            cputs("disk full?");
            cgetc();
        }
    }
    redraw_edit_screen();
    show_cursor();
    invalidate_loaded_anim();
}
开发者ID:MonteCarlos,项目名称:anim64,代码行数:27,代码来源:edit.c

示例14: get_input_terminated_by

/*
 * get_input_terminated_by() reads input (handling backspace correctly) until
 * a terminator of |terminators| is encountered or |out| is full (outlen-1
 * characters were read).
 *
 * get_input_terminated_by() returns the terminator it encountered.
 *
 */
input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators, char *out, BYTE outlen) {
	BYTE i = strlen(out);
	BYTE c, x, y;
	x = wherex() - i;
	y = wherey();
	while (1) {
		c = cgetc();
		if (((terminators & INPUT_TERMINATOR_RETURN) == INPUT_TERMINATOR_RETURN) && (c == PETSCII_CR)) {
			return INPUT_TERMINATOR_RETURN;
		} else if (((terminators & INPUT_TERMINATOR_SPACE) == INPUT_TERMINATOR_SPACE) && (c == PETSCII_SP)) {
			return INPUT_TERMINATOR_SPACE;
		} else if (c == PETSCII_DEL) {
			/* If you are at the left-most position, do nothing */
			if (i == 0)
				continue;
			out[--i] = '\0';
			cputcxy(x+i, y, ' ');
			gotoxy(x+i, y);
			continue;
		}
		if (i == (outlen-1)) {
			continue;
		}
		cputc(c);
		out[i++] = c;
	}
}
开发者ID:nnev,项目名称:c128-kasse,代码行数:35,代码来源:general.c

示例15: main

int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
开发者ID:afester,项目名称:CodeSamples,代码行数:60,代码来源:main.c


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