sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / test / c / snprintf1.c
| 1 | #include "sqlite3.h" |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | int main(void) { |
| 5 | const char *zExpect = "2023.000"; |
| 6 | char szBuffer[32]; |
| 7 | double val = 2023.0; |
| 8 | #ifdef SQLITE_OMIT_AUTOINIT |
| 9 | sqlite3_initialize(); |
| 10 | #endif |
| 11 | sqlite3_snprintf(17, szBuffer, "%.3f", val); |
| 12 | printf("size 17: '%s'\n", szBuffer); |
| 13 | if( sqlite3_stricmp(zExpect, szBuffer) ) return 1; |
| 14 | sqlite3_snprintf(16, szBuffer, "%.3f", val); |
| 15 | printf("size 16: '%s'\n", szBuffer); |
| 16 | if( sqlite3_stricmp(zExpect, szBuffer) ) return 1; |
| 17 | return 0; |
| 18 | } |