54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
#include <gint/display.h>
|
|
#include <gint/keyboard.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <gint/gint.h>
|
|
#include <fxlibc/printf.h>
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main(void)
|
|
{
|
|
__printf_enable_fp();
|
|
|
|
dclear(C_WHITE);
|
|
|
|
char c[10] = "..........";
|
|
int ret = -1;
|
|
int n = -1;
|
|
|
|
ret = sscanf( "abcdefghij", "%c%n", &c[0], &n );
|
|
dprint( 1, 10, C_BLACK, "#1 : rd 1c : [%c] cn=%d rt=%d", c[0], n, ret );
|
|
|
|
ret = sscanf( "abcdefghij", "%c%*c%c%n", &c[0], &c[2], &n );
|
|
dprint( 1, 20, C_BLACK, "#2 : rd 1c + skp 1c + rd 1c : [%c][%c][%c] cn=%d rt=%d", c[0], c[1], c[2], n, ret );
|
|
|
|
ret = sscanf( "abcdefghij", "%3c%n", &c, &n );
|
|
dprint( 1, 30, C_BLACK, "#3 : rd 3c (w 3c) : [%c][%c][%c] cn=%d rt=%d", c[0], c[1], c[2], n, ret );
|
|
|
|
ret = sscanf( "abcdefghij", "%*5c%3c%n", &c, &n );
|
|
dprint( 1, 40, C_BLACK, "#4 : skp 5c + rd 3c (w 3c) : [%c][%c][%c] cn=%d rt=%d", c[0], c[1], c[2], n, ret );
|
|
|
|
ret = sscanf( "abcdefghij", "%n", &n );
|
|
dprint( 1, 50, C_BLACK, "#5 : no char : cn=%d rt=%d", n, ret );
|
|
|
|
char str[25] = ".........................";
|
|
ret = sscanf( "abcdefghij", "%s%n", str, &n );
|
|
dprint( 1, 60, C_BLACK, "#6 : rd 1s : [%s] cn=%d rt=%d", str, n, ret );
|
|
|
|
strcpy( str, "........................." );
|
|
ret = sscanf( "abcde ghij", "%s%n", str, &n );
|
|
dprint( 1, 70, C_BLACK, "#7 : rd 1s with space : [%s] cn=%d rt=%d", str, n, ret );
|
|
|
|
strcpy( str, "........................." );
|
|
ret = sscanf( "abcdefghij", "%*5c%s%n", str, &n );
|
|
dprint( 1, 80, C_BLACK, "#8 : skp 5c + rd 1str : [%s] cn=%d rt=%d", str, n, ret );
|
|
|
|
|
|
dupdate();
|
|
getkey();
|
|
|
|
return 1;
|
|
}
|