// filename:c2011-K-3-9-2-2-2-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 K.3.9.2.2.2 The wcsncat_s function // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. // Example 1 #define __STDC_WANT_LIB_EXT1__ 1 #include #include #include #include #include #include #include int main(void) { /* ... */ wchar_t s1[100] = L"good"; wchar_t s2[6] = L"hello"; wchar_t s3[6] = L"hello"; wchar_t s4[7] = L"abc"; wchar_t s5[1000] = L"bye"; int r1, r2, r3, r4; r1 = wcsncat_s(s1, 100, s5, 1000); r2 = wcsncat_s(s2, 6, L"", 1); r3 = wcsncat_s(s3, 6, L"X", 2); r4 = wcsncat_s(s4, 7, L"defghijklmn", 3); return printf("K.3.9.2.2.2 The wcsncat_s function %d %d %d %d \n",r1,r2,r3,r4 ); } // output may be