5 wchar_t fmt1[] = L" 1 2 3 4 5";
6 wchar_t fmt2[] = L"12345678901234567890123456789012345678901234567890";
8 void test_wmemchr( void )
13 wchar_t str[] = L"lazy";
14 wchar_t string1[60] = L"The quick brown dog jumps over the lazy fox";
16 wprintf( L"Wmemchr\n" );
17 wprintf( L"String to be searched:\n\t\t%s\n", string1 );
18 wprintf( L"\t\t%s\n\t\t%s\n\n", fmt1, fmt2 );
20 wprintf( L"Search char:\t%c\n", ch );
21 dest = wmemchr( string1, ch, sizeof( string1 ) );
22 result = dest - string1 + 1;
24 wprintf( L"Result:\t\t%c found at position %d\n\n", ch, result );
26 wprintf( L"Result:\t\t%c not found\n\n" );
29 void test_wmemset( void )
31 0123456789012345678901234567890 */
32 wchar_t buffer[] = L"This is a test of the wmemset function";
33 wprintf( L"Before: %s\n", buffer );
34 wmemset( buffer+22, L'*', 7 );
35 wprintf( L"After: %s\n\n", buffer );
39 void test_wmemmove( void )
41 wchar_t string1[60] = L"The quick brown dog jumps over the lazy fox";
42 wchar_t string2[60] = L"The quick brown fox jumps over the lazy dog";
44 wprintf( L"Wmemcpy without overlap\n" );
45 wprintf( L"Source:\t\t%s\n", string1 + 40 );
46 wprintf( L"Destination:\t%s\n", string1 + 16 );
47 wmemcpy( string1 + 16, string1 + 40, 3 );
48 wprintf( L"Result:\t\t%s\n", string1 );
49 wprintf( L"Length:\t\t%d characters\n\n", wcslen( string1 ) );
50 wmemcpy( string1 + 16, string2 + 40, 3 );
52 wprintf( L"Wmemmove with overlap\n" );
53 wprintf( L"Source:\t\t%s\n", string2 + 4 );
54 wprintf( L"Destination:\t%s\n", string2 + 10 );
55 wmemmove( string2 + 10, string2 + 4, 40 );
56 wprintf( L"Result:\t\t%s\n", string2 );
57 wprintf( L"Length:\t\t%d characters\n\n", wcslen( string2 ) );
59 wprintf( L"Wmemcpy with overlap\n" );
60 wprintf( L"Source:\t\t%s\n", string1 + 4 );
61 wprintf( L"Destination:\t%s\n", string1 + 10 );
62 wmemcpy( string1 + 10, string1 + 4, 40 );
63 wprintf( L"Result:\t\t%s\n", string1 );
64 wprintf( L"Length:\t\t%d characters\n\n", wcslen( string1 ) );
68 void test_wmemcmp( void )
70 wchar_t first[] = L"12345678901234567890";
71 wchar_t second[] = L"12345678901234567891";
73 wprintf(L"Wmemcmp\n");
74 wprintf( L"Compare '%.19s' to '%.19s':\n", first, second );
75 result = wmemcmp( first, second, 19 );
77 wprintf( L"First is less than second.\n" );
78 else if( result == 0 )
79 wprintf( L"First is equal to second.\n" );
81 wprintf( L"First is greater than second.\n" );
82 wprintf( L"\nCompare '%.20s' to '%.20s':\n", first, second );
83 result = wmemcmp( first, second, 20 );
85 wprintf( L"First is less than second.\n\n" );
86 else if( result == 0 )
87 wprintf( L"First is equal to second.\n\n" );
89 wprintf( L"First is greater than second.\n\n" );