5
DB12->printf("This is the value of num: %d", num);
d, i
int, signed decimal number
o
int, unsigned octal number
x
int, unsigned hexadecimal number using a-f for 10-15
X
int, unsigned hexadecimal number using A-F for 10-15
u
int, unsigned decimal
c
int, single character
s
char *, display from a string until '\0'
p
void *, pointer
putchar
This will display a single ASCII character on the screen.
Function Prototype: int putchar(int);
Return Value: The character that was displayed.
GetCmdLine
This function is used to read in a line of data from the user and store it in an
array. Each character that is entered is echoed back to the screen using a call to
the putchar function. Only printable ASCII characters are accepted by the function
with the exception of carriage return and backspace.
Function Prototype: int GetCmdLine(char *CmdLineStr, int CmdLineLen);
Return Value: An error code of NoErr.
The location where data that is read in is stored and the number of characters that
are to be read, are determined by CmdLineStr and CmdLineLen respectively.
CmdLineStr is a char array that is created by the programmer. This is where the
input line from the user is stored.
CmdLineLen is the length of the string to be read in. A total of CmdLineLen -1
characters may be entered by the user before the GetCmdLine function exits. The
user may also use a carriage return to exit before the value of CmdLineLen has been
reached.
Backspace may be used to delete unwanted characters from the line that the user
entered. The character will be erased from the screen and the memory array.
isxdigit
This routine determines if c is a member of the set 0..9, a..z and A…Z
Function prototype: int isxdigit(int c);
Return Value: If c is part of the set the function returns
true (1), if c is not a part of the set the function
returns a false (0).