实现了标准C语言库函数printf scanf功能
源代码在线查看: printf.c
/**************标准C语言库函数的实现**********************、
/*
* Printf.c
* Copyright (c) 2008 ,WuRen
* Date:2008-04-25
* V1.00
*/
#include "Printf.h"
#include "stdlib.h"
#include "stdio.h"
#include "stdarg.h"
#include "GUI.h"
void Printf(char *fmt,...)
{
va_list arg;
char string[256];
va_start(arg,fmt);
vsprintf(string,fmt,arg);
PrintfPuts(string);
va_end(arg);
}
void GUI_GetString(char *string)
{
char *string2=string;
char c;
while((c=GUI_WaitKey())!='\r')
{
if(c=='\b')
{
if( (int)string2 < (int)string )
{
GUI_DispString("\b \b");
string--;
}
}
else
{
*string++=c;
GUI_DispChar(c);
}
}
*string='\0';
GUI_DispChar('\n');
}