printf.txt›----------›› The printf function enables you›to print information to the screen›or any device. It takes a variable›number of arguments. If the first›argument is less than 255, it is›assumed to be an iocb #, and›everything is sent to that iocb. ›Otherwise the output is sent to the›screen (iocb #0). The next argument›is the format string, followed by›any additional arguments. ›Everything in the format string will›be sent out until a % is›encountered. The character(s)›following the % determine how the›argument is to be printed. The›first % is for the first argument›after the format string, the second›for the second argument, and so on. ›Too few arguments will cause garbage›to be printed. The following›characters may be used after the %:›c - print a character›d - print an integer›f - print a floating point number›s - print a string›x - print a hexadecimal number›% - print a percent sign››Note: A character, integer, or›hexadecimal value may be obtained›from any variable defined as either›char or int. A floating point›number is assumed to have been›defined as a 6 element char array.› A number between the % and the›character defines the field width. ›If there aren't enough characters or›numbers in the argument, it will be›filled out with spaces. A '-'›before the number will left justify›the field. A decimal point and a›number will determine the decimal›part printed in a floating point›number, padded with up to 2 zeros if›there aren't enough.› Here are some examples:›printf(">abcd<"); produces› >abcd<›printf(">%s<","abcd"); produces › >abcd<›printf(">%10s<","abcd"); produces› > abcd<›printf(">%-10s<","abcd"); produces› >abcd <›printf("%c %d %x",65,65,65);›produces› A 65 41›››