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


C++ printchar函数代码示例

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


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

示例1: render_end_sw

void render_end_sw( struct machine *oric )
{
  int i;
  Uint32 char_pitch;
  Uint8 *dst_pixel;

  char_pitch = 8 * pixel_size;

  if( oric->emu_mode == EM_RUNNING )
  {
    if( oric->popupstr[0] )
    {
      dst_pixel = (Uint8*)screen->pixels;
      dst_pixel += 320 * pixel_size;

      for( i=0; oric->popupstr[i]; i++, dst_pixel += char_pitch )
        printchar( dst_pixel, oric->popupstr[i], gpal[1], gpal[0], SDL_TRUE );
    }
  
    if( oric->statusstr[0] )
    {
      dst_pixel = (Uint8*)screen->pixels;
      dst_pixel += 466 * screen->pitch;

      for( i=0; oric->statusstr[i]; i++, dst_pixel += char_pitch )
        printchar( dst_pixel, oric->statusstr[i], gpal[1], 0, SDL_FALSE );
    }
  }

  if( SDL_MUSTLOCK( screen ) )
    SDL_UnlockSurface( screen );

  SDL_COMPAT_Flip( screen );
}
开发者ID:Akheon23,项目名称:oriculator,代码行数:34,代码来源:render_sw.c

示例2: dumpcode

void dumpcode(unsigned char *buff, int len)
{
	int i;
		printk("----------BEGIN DUMP----------\n");
   
		for(i=0;i<len;i++)
		{
		if(i%16==0)
			printk("0x%08X  ",(int)&buff[i]);
            printk("%02X ",buff[i]);
		if(i%16-15==0)
		{
			int j;
			printk("  ");
			for(j=i-15;j<=i;j++)
			printchar(buff[j]);
			printk("\n");
		}
}
			if(i%16!=0)
			{
			int j;
			int spaces=(len-i+16-i%16)*3+2;
			for(j=0;j<spaces;j++)
			printk(" ");
			for(j=i-i%16;j<len;j++)
			printchar(buff[j]);
			}
			printk("\n");
		printk("---------END DUMP----------\n");
 } 
开发者ID:perillamint,项目名称:hideroot,代码行数:31,代码来源:dumpcode.c

示例3: readstring

/*when return is pressed, it returns with the finished buffer*/
void readstring(char* buffer)
{
	int index=0;
	char c=0x00;

	/*wait for ENTER (0xd)*/
	while (c!=0xd)
	{
		/*read a character from the keyboard*/
		c=readchar();
		/*if not backspace, put it in the buffer & print it*/
		if (c!=8)
		{
			printchar(c);
			buffer[index]=c;
			index++;
		}
		/*if it is backspace, space over the last character*/
		else if (index>0)
		{
			printchar(c);
			printchar(0x20);
			printchar(c);
			index--;
		}
	}
	/*put in a line feed and print it*/
	buffer[index]=0xa;
	printchar(buffer[index]);
	/*terminate with a 0*/
	buffer[index+1]=0;
}
开发者ID:nrecarte,项目名称:Utilidades,代码行数:33,代码来源:kernel.c

示例4: main

void main()
{
   int x;

   a[0] = 12;
   a[1] = 10;
   a[2] = 8;
   a[3] = 6;
   a[4] = 4;
   a[5] = 2;

   x = a[5];
   printint(x);    // 2
   printchar(10);

   printint(a[0]);  // 12
   printchar(10);

   printint(10+a[1]);  // 20
   printchar(10);

   x = a[2]*10 + a[3] + a[4];
   printint(x);  // should be 90
   printchar(10);

}
开发者ID:Caskman,项目名称:Clike-Compiler,代码行数:26,代码来源:array1.c

示例5: prints

static int prints(char **out, const char *string, int width, int pad)
{
    register int pc = 0, padchar = ' ';

    if (width > 0) {
        register int len = 0;
        register const char *ptr;
        for (ptr = string; *ptr; ++ptr) ++len;
        if (len >= width) width = 0;
        else width -= len;
        if (pad & PAD_ZERO) padchar = '0';
    }
    if (!(pad & PAD_RIGHT)) {
        for ( ; width > 0; --width) {
            printchar (out, padchar);
            ++pc;
        }
    }
    for ( ; *string ; ++string) {
        printchar (out, *string);
        ++pc;
    }
    for ( ; width > 0; --width) {
        printchar (out, padchar);
        ++pc;
    }

    return pc;
}
开发者ID:psallandre,项目名称:RaceCapture-Pro_firmware,代码行数:29,代码来源:printf-stdarg.c

示例6: simple_serial_print_strint

/* print a string and an int */
void
simple_serial_print_strint(char *s, uint16_t i)
{
  uint8_t intprinted = 0;
  char c = 'A';
  while(c != 0) {
    c = *s++;
    if(c == '\\' && *s == 'n') {
      /* print line return and continue */
      printchar('\n');
      s++;
    } else if(c == '\\' && *s == 't') {
      printchar('\t');
      s++;
    } else if(c == '%' && *s == 'u') {
      intprinted = 1;
      simple_serial_print_u16(i);
    } else {
      printchar(c);
    }
  }

  if(intprinted == 0) {
    simple_serial_print_u16(i);
  }
  printchar('\n');
}
开发者ID:dirtwillfly,项目名称:contiki-launchpad,代码行数:28,代码来源:simple-serial.c

示例7: watchdog_interrupt

watchdog_interrupt(void)
{
#ifdef CONTIKI_TARGET_SKY
#if PRINT_STACK_ON_REBOOT
  uint8_t dummy;
  static uint8_t *ptr;
  static int i;

  ptr = &dummy;
  printstring("Watchdog reset");
  printstring("\nStack at $");
  hexprint(((int)ptr) >> 8);
  hexprint(((int)ptr) & 0xff);
  printstring(":\n");

  for(i = 0; i < 64; ++i) {
    hexprint(ptr[i]);
    printchar(' ');
    if((i & 0x0f) == 0x0f) {
      printchar('\n');
    }
  }
  printchar('\n');
#endif /* PRINT_STACK_ON_REBOOT */
#endif /* CONTIKI_TARGET_SKY */

  watchdog_reboot();
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:28,代码来源:watchdog.c

示例8: vprintk

int vprintk(const int8 * format, char * ap)
{
	int pc; 	//printf的返回值
	
	pc = 0;
	for (; *format != '\0'; ++format) {
		if (*format == '%') {
			++format;
			if ((*format) == 'c') {
				printchar(va_arg(ap, int));
				pc++;
			} else if (*format == 'd') {
				printi(va_arg(ap, int));
				pc++;
			} else if (*format == 's') {
				prints((va_arg(ap, char*)));
				pc++;
			} else if (*format == 'x') {
				printx((va_arg(ap, int)));
				pc++;
			} else  {
				printchar(*format);
				pc++;
				
			}
		} else {
			printchar(*format);
			pc++;
		}

	}

	return pc;

}
开发者ID:shui8023,项目名称:shui_os,代码行数:35,代码来源:debug.c

示例9: mycompare

int mycompare(const char *student, const char *model, char *infostr)
{
    int i = 0, line = 1;
    char bufS[16] = { 0 };
    char bufM[16] = { 0 };
    while(*student) {
        printchar(bufS, *student);
        printchar(bufM, *model);
        if (!(*model)) {
            sprintf(infostr, "your output is longer than expected: character: '%s', position: %d, line: %d\n",
                    bufS, i+1, line);
            return -1;
        }
        if (*student != *model) {
            sprintf(infostr, "position: %d, line: %d, your output: '%s' , expected: '%s'\n", 
                    i+1, line, bufS, bufM);
            return -1;
        }
        if (*student == '\n') {
            line++;
            i = -1;
        }
        student++; model++; i++;
    }
    if (*model) {
        printchar(bufM, *model);
        sprintf(infostr, "output correct until position: %d, line: %d, but shorter than expected. Next character should be '%s'\n",
                i+1, line, bufM);
        return -1;
    }
    return 0;
}
开发者ID:gstraube,项目名称:c_exercises,代码行数:32,代码来源:checkhelp.c

示例10: prints

static int prints(char **out, const char *string, int width, int pad, int printlimit, bool IsNumber)
{
        register int pc = 0, padchar = ' ';
        int i,len;

        if (width > 0) {
        	register int len = 0;
        	register const char *ptr;
        	for (ptr = string; *ptr; ++ptr) ++len;
        	if (len >= width) width = 0;
        	else width -= len;
        	if (pad & PAD_ZERO) padchar = '0';
        }
        if (!(pad & PAD_RIGHT)) {
        	for ( ; width > 0; --width) {
        		printchar (out, padchar);
        		++pc;
        	}
        }
        if( false == IsNumber )
        {      // The string to print is not the result of a number conversion to ascii.
           /* For a string, printlimit is the max number of characters to display. */
           for ( ; printlimit && *string ; ++string, --printlimit) {
              printchar (out, *string);
              ++pc;
           }
        }
        if( true == IsNumber )
        {      // The string to print represents an integer number.
           /* In this case, printlimit is the min number of digits to print. */

           /* If the length of the number to print is less than the min nb of i
              digits to display, we add 0 before printing the number. */
           len = strlen(string);
           if( len < printlimit )
           {
              i = printlimit - len;
              for(; i; i--) {
                 printchar (out, '0');
                 ++pc;
              }
           }
        }
        /* Else: The string to print is not the result of a number conversion to ascii.
         * For a string, printlimit is the max number of characters to display.
         */

        for ( ; printlimit && *string ; ++string, --printlimit) {
           printchar (out, *string);
           ++pc;
        }

        for ( ; width > 0; --width) {
        	printchar (out, padchar);
        	++pc;
        }

        return pc;
}
开发者ID:InSoonPark,项目名称:asf,代码行数:59,代码来源:printf-stdarg.c

示例11: printHexDigit

 // Assuming n is in [0, 15].
 static void printHexDigit(uint8 n) {
   if (n < 10) {
     printchar((char)('0' + n));
   } 
   else {
     printchar((char)(('a' - 10) + n));
   }    
 }
开发者ID:JBTech,项目名称:linbus,代码行数:9,代码来源:sio.cpp

示例12: printulhex

static void	printulhex(unsigned long addr)
{
  unsigned long lu = addr / 0x10;
  if (lu) printulhex(lu);
  lu = addr % 0x10;
  if (lu < 10)
    printchar(lu + '0');
  else
    printchar(lu % 10 + 'A');
}
开发者ID:nicolascormier,项目名称:m-kernel-draft,代码行数:10,代码来源:console.c

示例13: PrintInfo

void PrintInfo(char *name, unsigned long int sernum, unsigned long int RegNum)
  {
  int x;
  char temp[201];

  printchar(ESC);
  printchar('E');
  printchar(ESC);
  printstring("(10U");           // Ascii characters
  printchar(ESC);
  printstring("(s14V");           // 12 points

  printchar(ESC);
  printstring(")10U");           // Ascii characters
  printchar(ESC);
  printstring(")s14V");           // 12 points
  printchar(ESC);
  printstring("&l0O");    // print orientation 0=norm 1=portrait 2=rev norm 3= rev port 
  for(x=0;x<59;x++) printstring("\n\r");

  printstring( "      ���������������������������������������������������������������Ŀ\n\r");
  sprintf(temp,"      �           User Name: %30s           �\n\r",name);
  printstring(temp);
  sprintf(temp,"      �       Serial Number: %30lu           �\n\r",sernum);
  printstring(temp);
  sprintf(temp,"      � Registration Number: %30lu           �\n\r",RegNum);
  printstring(temp);
  printstring( "      �����������������������������������������������������������������\n\r");
  printstring("\n\r");
  printchar(ESC);      // reset printer command 
  printchar('E');      // ie. Form Feed
  }
开发者ID:Mikelle02,项目名称:GameMaker,代码行数:32,代码来源:TELLREG#.C

示例14: printf

int printf(const char *format, ...) {
	char const *p = format;
	char buf[20];
	void *args = (&format + 1);
	int argn = 0;
	bool isfmt = false;
	int len = 0;
	
	do {
		if(*p == '\0') break;
		if(!isfmt && *p != '%') {
			printchar(*p);
			len++;
		} else if(isfmt) {
			switch(*p) {
				case 'c':
					printchar(((char*)args)[argn++]);
					len++;
					break;
				case 's':
					printstr(((char**)args)[argn]);
					len += (int)strlen(((char**)args)[argn++]);
					break;
				case 'd':
					len += (int)strlen(itoa(((int*)args)[argn++], buf, 10));
					printstr(buf);
					break;
				case 'u':
					len += (int)strlen(utoa(((uint*)args)[argn++], buf, 10));
					printstr(buf);
					break;
				case 'o':
					len += (int)strlen(utoa(((uint*)args)[argn++], buf, 8));
					printstr(buf);
					break;
				case 'x':
				case 'p':
					len += (int)strlen(utoa(((uint*)args)[argn++], buf, 16));
					printstr(buf);
					break;
				case '%':
					printchar('%');
					len++;
					break;
				default:
					return -1;
			}
			isfmt = false;
		} else if(*p == '%') {
			isfmt = true;
		}
	} while(*p++);

	return len;
}
开发者ID:levelfour,项目名称:swallow,代码行数:55,代码来源:stdio.c

示例15: main

int main(void)
{
	/* Start led connected to P1.29 and P1.18 */
	LPC_GPIO1->FIODIR |= 0x20040000;
	LPC_GPIO1->FIOSET |= (1 << 29);
	LPC_GPIO1->FIOCLR |= (1 << 18);

	SystemInit(); // lpc1768_startup.c
	SystemCoreClockUpdate();
	GPIOInit();
	TimerInit();
	ValueInit();
	ADCInit();

	comm_init();
//	welcomeMsg();
	set_echo();
	easyWEB_init();
	printchar("at+ndhcp=1\r");
	printchar("at+wa=greenet\r");
	printchar("at+nstcp=20\r");
	printchar("                              \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");

	while(1)
	{
		easyWEB_s_loop();
		//handle_command();	//UART command
		if(UpdateChannel >= 3)
		{
			UpdateChannel = -1;
			ADCRead(0);
			if (mode ==1)  //decide which ADC channel to read when the converter is working in different direction
			{
				Vout = ADCValues(0);
				Vin = ADCValues(1);
			}
			else
			{
				Vout = ADCValues(1);
				Vin = ADCValues(0);
			}
			Iref = ADCValues(2);
			Il = abs (ADCValues(3) - Iref); //get the correct inductor current
			MeanValues();
			BangBang();
			LPC_GPIO1->FIOPIN ^= (1 << 29);
			LPC_GPIO1->FIOPIN ^= (1 << 18);
		}

	}

	return 0;
}
开发者ID:tasos85,项目名称:summer,代码行数:53,代码来源:main.c


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