/
clang
/
sqlite
Обзор
Документация
Войти
/
clang
/
sqlite
Код
Вики
Пакеты
0
Релизы
0
Аналитика
master
test/c/snprintf1.c
18 строк
489 B
dan
Update test/c/snprintf1.c to test the result of the sqlite3_snprintf() call. Also add an SQLITE_OMIT_AUTOINIT configuration and update C tests to account for it.
13 апр 2026, 14:20
13 апр 2026, 14:20
dd1e2c3
Код
Авторство
О чём код?
#include "sqlite3.h" #include <stdio.h> int main(void) { const char *zExpect = "2023.000"; char szBuffer[32]; double val = 2023.0; #ifdef SQLITE_OMIT_AUTOINIT sqlite3_initialize(); #endif sqlite3_snprintf(17, szBuffer, "%.3f", val); printf("size 17: '%s'\n", szBuffer); if( sqlite3_stricmp(zExpect, szBuffer) ) return 1; sqlite3_snprintf(16, szBuffer, "%.3f", val); printf("size 16: '%s'\n", szBuffer); if( sqlite3_stricmp(zExpect, szBuffer) ) return 1; return 0; }