Changeset 628 for trunk/libs
- Timestamp:
- May 6, 2019, 1:28:01 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/mini-libc/stdio.c
r625 r628 51 51 } 52 52 53 /////////////////////////////////////////////////// 53 //////////////////////////////////////////////////////////////////////////////////////// 54 // This static function analyses the <format> and the <args> to build a formated 55 // string in the buffer defined by <string> and <length>. 56 // It does NOT add a terminating NUL character in the <string buffer>. 57 // If success, it returns the number of bytes actually copied in the string buffer. 58 // It returns -1 in case of illegal format, or if the formated string exceeds the 59 // the length argument. 60 //////////////////////////////////////////////////////////////////////////////////////// 54 61 static int xprintf( char * string, 55 62 int length, … … 57 64 va_list * args ) 58 65 { 59 int ps = 0; // write index tothe string buffer66 int ps = 0; // index in the string buffer 60 67 61 68 #define TO_STREAM(x) do { string[ps] = (x); ps++; if(ps==length) return -1; } while(0); … … 83 90 84 91 { 85 char buf[30]; // buffer to displayone number92 char buf[30]; // buffer to store the string for one number 86 93 char * pbuf; // pointer on first char to display 87 94 unsigned int len = 0; // number of char to display
Note: See TracChangeset
for help on using the changeset viewer.