home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / i18nv104.zip / REF / I18N.INF (.txt)
OS/2 Help File  |  1996-02-13  |  167KB  |  7,624 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Overview ΓòÉΓòÉΓòÉ
  3.  
  4. This package provides an internationalization toolkit for the development of 
  5. world-wide applications based on the X/Open Portability Guidelines, Issue 4 
  6. (XPG4). This industry standard was developed to ensure portability, 
  7. interoperability, and consistency of user environments across all compliant 
  8. systems. 
  9.  
  10. This package is not a full implementation of the X/Open XPG4 specification and 
  11. does not make any claims of XPG4 branding. It implements only the portions of 
  12. the XPG4 specification which deal with internationalization. X/Open is a 
  13. trademark of the X/Open Company Limited. 
  14.  
  15. The XPG4 internationalization programming model has the following features: 
  16.  
  17.    1. Applications can be written in a language-independent way, so that a 
  18.       single version of the application can support users throughout the world. 
  19.       This eliminates the need for multiple language-specific versions and can 
  20.       dramatically reduce development, manufacturing and distribution costs. 
  21.  
  22.    2. Applications can "automatically" interact with international users in 
  23.       their own language, correct cultural conventions, and national data 
  24.       encoding. 
  25.  
  26.    3. The selection of localization features is user-definable through language 
  27.       environment variables. This announcement mechanism permits the dynamic 
  28.       loading of localization objects (locales), which give applications the 
  29.       correct cultural flavor. 
  30.  
  31.    4. The language is determined by the user, not the system or application. 
  32.       The same application can be launched in different languages on the same 
  33.       workstation, by simply changing the language environment settings. 
  34.  
  35.    5. New languages, countries and code pages can easily be supported by simply 
  36.       providing new locale objects, without requiring any change to 
  37.       applications. 
  38.  
  39.    6. Locale objects contain information to support the following types of 
  40.       culturally correct processing: 
  41.  
  42.         a. date and time formatting 
  43.  
  44.         b. numerical formatting 
  45.  
  46.         c. monetary formatting 
  47.  
  48.         d. text sorting 
  49.  
  50.         e. character classification 
  51.  
  52.         f. character case conversion 
  53.  
  54.         g. processing of single or multi-byte character text 
  55.  
  56.         h. text processing using wide-characters 
  57.  
  58.    7. Utilities are provided to permit the packaging of application-specific 
  59.       translatable text in external message files. Messaging interfaces are 
  60.       provided to access the correct message language at run-time, as specified 
  61.       by the locale environment variables. 
  62.  
  63.   This package consists of a set of APIs, commands and locale .dll's which 
  64.  implement this internationalization support. This technical reference contains 
  65.  lists of these items as well as the programming guidelines for using them 
  66.  effectively. 
  67.  
  68.  
  69. ΓòÉΓòÉΓòÉ 1.1. Locale model ΓòÉΓòÉΓòÉ
  70.  
  71. The I18N library is based on the concept of locale objects, which can be loaded 
  72. at run-time and provide all information which is specific to a particular 
  73. language/territory/code-page combination. 
  74.  
  75. A territory is usually a country, but could be any geographical area. A 
  76. particular territory could have several different locales which correspond to 
  77. different languages. For example, Switzerland has locales for both the German 
  78. and French locales. Also, a particular language may be spoken in several 
  79. different territories and there may be several locales associated with these 
  80. combinations. For example, French is spoken in France, Canada, Switzerland and 
  81. Belgium, so that there are four locales corresponding to these combinations. 
  82. Finally, a particular language/territory combination can be use with several 
  83. different code pages. For example, English in the US is available in three 
  84. different locales, which support code pages IBM-437, IBM-850 and IBM-819 
  85. (ISO8859-1). 
  86.  
  87. In general, a locale name has the following format: 
  88.  
  89.      Xx_YY.ZZZZZZZZ
  90.  
  91. where Xx is a language abbreviation, YY is a territory abbreviation, and 
  92. .ZZZZZZZZ is an code page name (generally "IBM-NNNN" where NNNN is a 3 or 4 
  93. digit codepage number).  So, to set the locale to US English, one could type: 
  94.  
  95.      set LANG=En_US
  96.  
  97. The US English locale corresponding to the current process code page would be 
  98. then be loaded. 
  99.  
  100. To force the locale for the IBM-437 code page, one could type: 
  101.  
  102.      set LANG=En_US.IBM-437
  103.  
  104. The actual locales are stored in dynamic link libraries (in \i18n\locale). The 
  105. names of the .DLL files are similar to the full names shown above, but with the 
  106. underscore, period and "IBM-" removed.  So the default US English locale DLL 
  107. file is ENUS437.DLL. This is done to support FAT file systems, which enforce 
  108. file name lengths of 8.3. 
  109.  
  110. The I18N package also provides the ability to define locale aliases. These are 
  111. stored in "\i18n\locale\ALIASES". The table consists of rows of aliases. Each 
  112. row contains the alias DLL name and the true DLL name, separated by a space. 
  113. The alias file is an ASCII text file, and can be edited. 
  114.  
  115. Locale aliasing using the ALIASES file always takes place before any attempt to 
  116. load a locale. 
  117.  
  118. The following is a list of locales provided in this release: 
  119.  
  120. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  121. ΓöéDLL       ΓöéLocale Name    ΓöéLocale Description                                Γöé
  122. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  123. Γöé(setloc1) ΓöéC              ΓöéDefault locale if no locale DLL can be loaded.    Γöé
  124. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  125. ΓöéARAA864   ΓöéAr_AA.IBM-864  ΓöéArabic in Arabic Area (Primary)                   Γöé
  126. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  127. ΓöéARAA1046  ΓöéAr_AA.IBM-1046 ΓöéArabic in Arabic Area (Alternate)                 Γöé
  128. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  129. ΓöéBGBG915   ΓöéBg_BG.IBM-915  ΓöéBulgarian in Bulgaria                             Γöé
  130. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  131. ΓöéCSCZ852   ΓöéCs_CZ.IBM-852  ΓöéCzech in Czech Republic (Primary)                 Γöé
  132. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  133. ΓöéCSCZ912   ΓöéCs_CZ.IBM-912  ΓöéCzech in Czech Republic (ISO8859-2)               Γöé
  134. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  135. ΓöéDADK850   ΓöéDa_DK.IBM-850  ΓöéDanish in Denmark                                 Γöé
  136. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  137. ΓöéDECH850   ΓöéDe_CH.IBM-850  ΓöéGerman in Switzerland                             Γöé
  138. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  139. ΓöéDEDE850   ΓöéDe_DE.IBM-850  ΓöéGerman in Germany (and Austria)                   Γöé
  140. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  141. ΓöéELGR869   ΓöéEl_GR.IBM-869  ΓöéGreek in Greece                                   Γöé
  142. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  143. ΓöéENGB850   ΓöéEn_GB.IBM-850  ΓöéEnglish in the U.K.                               Γöé
  144. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  145. ΓöéENUS437   ΓöéEn_US.IBM-437  ΓöéEnglish in the U.S. (Primary)                     Γöé
  146. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  147. ΓöéENUS850   ΓöéEn_US.IBM-850  ΓöéEnglish in the U.S. (Alternate)                   Γöé
  148. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  149. ΓöéENUS819   ΓöéEn_US.IBM-819  ΓöéEnglish in the U.S. (ISO8859-1)                   Γöé
  150. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  151. ΓöéESES850   ΓöéEs_ES.IBM-850  ΓöéSpanish in Spain                                  Γöé
  152. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  153. ΓöéFIFI850   ΓöéFi_FI.IBM-850  ΓöéFinnish in Finland                                Γöé
  154. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  155. ΓöéFRBE850   ΓöéFr_BE.IBM-850  ΓöéFrench in Belgium                                 Γöé
  156. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  157. ΓöéFRCA850   ΓöéFr_CA.IBM-850  ΓöéFrench in Canada                                  Γöé
  158. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  159. ΓöéFRCH850   ΓöéFr_CH.IBM-850  ΓöéFrench in Switzerland                             Γöé
  160. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  161. ΓöéFRFR850   ΓöéHr_FR.IBM-850  ΓöéFrench in France                                  Γöé
  162. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  163. ΓöéHRHR852   ΓöéHr_HR.IBM-852  ΓöéCroatian in Croatia (Primary)                     Γöé
  164. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  165. ΓöéHRHR912   ΓöéHr_HR.IBM-912  ΓöéCroatian in Croatia (ISO8859-2)                   Γöé
  166. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  167. ΓöéHUHU852   ΓöéHu_HU.IBM-852  ΓöéHungarian in Hungary (Primary)                    Γöé
  168. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  169. ΓöéHUHU912   ΓöéHu_HU.IBM-912  ΓöéHungarian in Hungary (ISO8859-2)                  Γöé
  170. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  171. ΓöéISIS850   ΓöéIs_IS.IBM-850  ΓöéIcelandic in Iceland                              Γöé
  172. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  173. ΓöéITIT850   ΓöéIt_IT.IBM-850  ΓöéItalian in Italy                                  Γöé
  174. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  175. ΓöéIWIL862   ΓöéIw_IL.IBM-862  ΓöéHebrew in Israel (Primary)                        Γöé
  176. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  177. ΓöéIWIL856   ΓöéIw_IL.IBM-856  ΓöéHebrew in Israel (Alternate)                      Γöé
  178. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  179. ΓöéJAJP932   ΓöéJa_JP.IBM-932  ΓöéJapanese in Japan (Primary)                       Γöé
  180. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  181. Γöé(alias)   ΓöéJa_JP.IBM-942  ΓöéJapanese in Japan (Alternate)                     Γöé
  182. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  183. ΓöéKOKR949   ΓöéKo_KR.IBM-949  ΓöéKorean in Korea                                   Γöé
  184. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  185. ΓöéMKMK915   ΓöéMk_MK.IBM-915  ΓöéMacedonian in Macedonia                           Γöé
  186. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  187. ΓöéNLBE850   ΓöéNl_BE.IBM-850  ΓöéFlemish in Belgium                                Γöé
  188. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  189. ΓöéNLNL850   ΓöéNl_NL.IBM-850  ΓöéDutch in Netherlands                              Γöé
  190. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  191. ΓöéNONO850   ΓöéNo_NO.IBM-850  ΓöéNorwegian in Norway                               Γöé
  192. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  193. ΓöéPLPL852   ΓöéPl_PL.IBM-852  ΓöéPolish in Poland (Primary)                        Γöé
  194. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  195. ΓöéPLPL912   ΓöéPl_PL.IBM-912  ΓöéPolish in Poland (ISO8859-2)                      Γöé
  196. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  197. ΓöéPTBR850   ΓöéPt_BR.IBM-850  ΓöéPortuguese in Brazil                              Γöé
  198. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  199. ΓöéPTPT850   ΓöéPt_PT.IBM-850  ΓöéPortuguese in Portugal                            Γöé
  200. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  201. ΓöéRORO852   ΓöéRo_RO.IBM-852  ΓöéRomanian in Romania                               Γöé
  202. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  203. ΓöéRURU866   ΓöéRu_RU.IBM-866  ΓöéRussian in Russia (Primary)                       Γöé
  204. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  205. ΓöéRURU915   ΓöéRu_RU.IBM-915  ΓöéRussian in Russia (ISO8859-5)                     Γöé
  206. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  207. ΓöéSHSP852   ΓöéSh_SP.IBM-852  ΓöéLatin Serbian in Serbia (Primary)                 Γöé
  208. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  209. ΓöéSHSP912   ΓöéSh_SP.IBM-912  ΓöéLatin Serbian in Serbia (ISO8859-2)               Γöé
  210. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  211. ΓöéSLSI852   ΓöéSl_SI.IBM-852  ΓöéSlovenian in Slovenia (Primary)                   Γöé
  212. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  213. ΓöéSLSI912   ΓöéSl_SI.IBM-912  ΓöéSlovenian in Slovenia (ISO8859-2)                 Γöé
  214. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  215. ΓöéSKSK852   ΓöéSk_SK.IBM-852  ΓöéSlovak in Slovakia (Primary)                      Γöé
  216. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  217. ΓöéSKSK912   ΓöéSk_SK.IBM-912  ΓöéSlovak in Slovakia (ISO8859-2)                    Γöé
  218. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  219. ΓöéSRSP915   ΓöéSr_SP.IBM-915  ΓöéCyrillic Serbian in Serbia                        Γöé
  220. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  221. ΓöéSVSE850   ΓöéSv_SE.IBM-850  ΓöéSwedish in Sweden                                 Γöé
  222. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  223. ΓöéTHTH874   ΓöéTh_TH.IBM-874  ΓöéThai in Thailand                                  Γöé
  224. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  225. ΓöéTRTR857   ΓöéTr_TR.IBM-857  ΓöéTurkish in Turkey                                 Γöé
  226. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  227. ΓöéZHCN1381  ΓöéZh_CN.IBM-1381 ΓöéSimplified Chinese in China                       Γöé
  228. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  229. ΓöéZHTW950   ΓöéZh_TW.IBM-950  ΓöéTraditional Chinese in Taiwan (Primary)           Γöé
  230. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  231. ΓöéZHTW948   ΓöéZh_TW.IBM-948  ΓöéTraditional Chinese in Taiwan (Alternate)         Γöé
  232. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  233.  
  234. In addition to using the 8.3 names (without the underscore or period) for 
  235. locale DLLs, the I18N package also uses those names for message catalog 
  236. directories.  So, suppose you had the following NLSPATH variable, and LANG 
  237. variable, with a process code page of 437: 
  238.  
  239.      set NLSPATH=E:\I18N\MESSAGES\%L\%N
  240.      set LANG=En_US
  241.  
  242. Further suppose you execute the following catalog open command in your program: 
  243.  
  244.      cat_handle = catopen("my.cat", 0);
  245.  
  246. catopen would then attempt to find the following file: 
  247.  
  248.      E:\I18N\MESSAGES\ENUS437\MY.CAT
  249.  
  250. That is because the locale (En_US) is remapped to ENUS437 (without the .DLL). 
  251. Look at the \I18N\MESSAGES directory in this package to see some of the locale 
  252. message directories provided. 
  253.  
  254.  
  255. ΓòÉΓòÉΓòÉ 1.2. Environment Variables ΓòÉΓòÉΓòÉ
  256.  
  257. The following environment variables are used for internationalization to 
  258. determine the behavior of the system.  The variables are inherited as defaults 
  259. by the application at boot time from CONFIG.SYS or set directly via the SET 
  260. command. 
  261.  
  262.  LOCPATH         specifies the search path(s) for the locale DLLs. Different 
  263.                  paths are separated by semicolons. 
  264.  
  265.  NLSPATH         specifies the search path(s) for locating the message catalog 
  266.                  files. Different paths are separated by semicolons. 
  267.  
  268.  LC_ALL    specifies the locale for all categories. Overrides LANG and other 
  269.  LC_* environment variables. 
  270.  
  271.  LC_COLLATE      specifies the locale for the LC_COLLATE (collation) category. 
  272.  
  273.  LC_CTYPE        specifies the locale for the LC_CTYPE category. This category 
  274.                  determines character classification, case mappings and 
  275.                  multibyte/widechar character processing. 
  276.  
  277.  LC_MESSAGES     specifies the locale for the LC_MESSAGES (message catatlog) 
  278.                  category. 
  279.  
  280.  LC_MONETARY     specifies the locale for the LC_MONETARY (monetary formatting) 
  281.                  category. 
  282.  
  283.  LC_NUMERIC      specifies the locale for the LC_NUMERIC (numeric formatting) 
  284.                  category. 
  285.  
  286.  LC_TIME         specifies the locale for the LC_TIME (date/time formatting) 
  287.                  category. 
  288.  
  289.  LANG            default setting of locale overridable by the preceding 
  290.                  environment variables. 
  291.  
  292.  When a call to setlocale is made, the settings are queried for priority level 
  293.  as follows: 
  294.  
  295.    1. If the LC_ALL environment variable is set, the value of the LC_ALL 
  296.       variable is used for all categories. 
  297.  
  298.    2. If the LC_ALL environment variable is not set, the values specified for 
  299.       medium-priority environment variables (LC_COLLATE, LC_CTYPE, LC_MESSAGES, 
  300.       LC_MONETARY, LC_NUMERIC, LC_TIME) are used. 
  301.  
  302.    3. If individual LC_* environment variables are not set, the value of the 
  303.       LANG environment variable specifies the locale for all remaining 
  304.       categories. 
  305.  
  306.    4. If the LANG environment variable is not set, the default locale is used 
  307.       for all remaining categories. 
  308.  
  309.  
  310. ΓòÉΓòÉΓòÉ 1.3. Using the CHAR datatype ΓòÉΓòÉΓòÉ
  311.  
  312. The CHAR datatype is still used in most cases but now it may contain multi-byte 
  313. characters as defined in the specific locale. A multi-byte character is 
  314. composed of one or more bytes, with no imbedded null bytes. The standard C str* 
  315. functions are still used to manipulate these kinds of strings, with the 
  316. exception of: 
  317.  
  318.  strcmp         doesn't handle < or > comparisons culturally. However, strcmp 
  319.                 still works for equal/not equal tests.  To determine greater 
  320.                 than/less than on strings, use the strcoll and strxfrm 
  321.                 functions. 
  322.  strncpy        is not multi-byte aware and may only copy only part of a 
  323.                 multi-byte character. 
  324.  strstr         is not multi-byte aware for single character strings but will 
  325.                 work with strings >1 character as the search key. 
  326.  strchr/strrchr for character searching its not multi-byte aware and so may 
  327.                 find a single byte character amid a multi-byte sequence. 
  328.  
  329.  
  330. ΓòÉΓòÉΓòÉ 1.4. Wide character datatype ΓòÉΓòÉΓòÉ
  331.  
  332. The XPG4 programming model defines a new character datatype wchar_t for 16-bit 
  333. character code elements.  The wchar_t datatype extends the range of the 
  334. standard char datatype to 16-bit characters. In general programmers only need 
  335. to use this datatype when direct character manipulation is needed on multi-byte 
  336. character data. 
  337.  
  338. Special functions are provided to convert between multi-byte and wchar strings 
  339. (see mbstowcs, wcstombs, mbtowc, and wctomb functions below), and to copy, 
  340. compare, or search wchar strings (see wcs* functions below). 
  341.  
  342. The XPG4 programming model doesn't dictate the code page of the wchar_t 
  343. variables.  Wide characters can be used in any code page. 
  344.  
  345. As a programmer writing NLS programs, you can not assume anything about what 
  346. value a wchar_t variable may contain, because it can vary from locale to 
  347. locale, and from vendor to vendor. 
  348.  
  349. Instead, you must use the I18N functions to manipulate and test wchar_t 
  350. variables to insure proper operation of your program in an international 
  351. environment.  These functions are described, in detail, below.  Typically, wide 
  352. character functions either start with the prefix "wcs" (as in wcscpy - wide 
  353. character copy), or have the letter "w" inserted in the function name (as in 
  354. "iswalpha" - is the wide character an alphabetic character). 
  355.  
  356. Note:  Wide characters and strings *can* be represented in your program as 
  357.        literal values.  Place the capital letter 'L' in front of your literal 
  358.        characters and strings. 
  359.  
  360.                    wcscpy(a_wide_var, L"A wide char string!");
  361.                    if (a_wide_char_var == L'\0') ...
  362.  
  363.  
  364. ΓòÉΓòÉΓòÉ 1.5. Recommended Reading ΓòÉΓòÉΓòÉ
  365.  
  366. The Library of NLS recommends the following books: 
  367.  
  368.  GG24-3850   ITSC AIX 3.2 Natl Language Support 
  369.  
  370.  SC23-2431   Internationalization of AIX Software: A Programmer's Guide 
  371.  
  372.  XOPEN       X/Open CAE Specification, Issue 4 
  373.  
  374.  
  375. ΓòÉΓòÉΓòÉ 2. Prototypes of I18N Functions ΓòÉΓòÉΓòÉ
  376.  
  377. The I18N internationalization library consists of over 80 different application 
  378. programming interfaces (APIs) which you can use to internationalize your 
  379. applications.  This section lists the categories and prototypes of these APIs. 
  380.  
  381.    1. Runtime Locale Load/Query Function: 
  382.  
  383.  
  384.                 char *setlocale(int category, const char *locale);
  385.                 char  *nl_langinfo(nl_item item);
  386.                 struct lconv *localeconv(void);
  387.  
  388.    2. Messages Catalog Functions: 
  389.  
  390.  
  391.                 nl_catd   catopen(const char *name, int oflag);
  392.                 char     *catgets(nl_catd catd, int set_id, int msg_id, const char *s);
  393.                 int       catclose(nl_catd catd);
  394.  
  395.    3. File I/O functions: 
  396.  
  397.  
  398.                 wint_t   fgetwc(FILE *stream);
  399.                 wchar_t *fgetws(wchar_t *s, int n, FILE *stream);
  400.  
  401.                 wint_t   fputwc(const wint_t wc, FILE *stream);
  402.                 int      fputws(const wchar_t *s, FILE *stream);
  403.  
  404.                 wint_t   getwc(FILE *stream);
  405.                 wint_t   putwc(wint_t c, FILE *stream);
  406.                 wint_t   ungetwc(wint_t c, FILE *stream);
  407.  
  408.                 wint_t   getwchar(void);
  409.                 wint_t   putwchar(wint_t c);
  410.  
  411.                 int      getw(register FILE *stream);
  412.                 int      putw(int w, register FILE *stream);
  413.  
  414.    4. Code Set Conversion Functions: 
  415.  
  416.  
  417.                 iconv_t iconv_open(const char *tocode, const char *fromcode);
  418.  
  419.                 size_t  iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
  420.                                                 char **outbuf, size_t *outbytesleft);
  421.  
  422.                 int     iconv_close(iconv_t cd);
  423.  
  424.    5. Character Attribute testing (Uses locale-based methods): 
  425.  
  426.  
  427.                int isalnum(int c);
  428.                int isalpha(int c);
  429.                int iscntrl(int c);
  430.                int isdigit(int c);
  431.                int isgraph(int c);
  432.                int islower(int c);
  433.                int isprint(int c);
  434.                int ispunct(int c);
  435.                int isspace(int c);
  436.                int isupper(int c);
  437.                int isxdigit(int c);
  438.  
  439.                int toupper(int c);
  440.                int tolower(int c);
  441.  
  442.                int iswalnum(wint_t wc);
  443.                int iswalpha(wint_t wc);
  444.                int iswcntrl(wint_t wc);
  445.                int iswdigit(wint_t wc);
  446.                int iswgraph(wint_t wc);
  447.                int iswlower(wint_t wc);
  448.                int iswprint(wint_t wc);
  449.                int iswpunct(wint_t wc);
  450.                int iswspace(wint_t wc);
  451.                int iswupper(wint_t wc);
  452.                int iswxdigit(wint_t wc);
  453.  
  454.                int iswctype(wint_t wc, wctype_t mask);
  455.  
  456.                wint_t towupper(wint_t wc);
  457.                wint_t towlower(wint_t wc);
  458.  
  459.  
  460.    6. The basic conversion methods for multibyte and wchar_t: 
  461.  
  462.  
  463.                 int    mblen   (const char *s, size_t n);
  464.                 size_t mbstowcs(wchar_t *ws, const char *s, size_t n);
  465.                 int    mbtowc  (wchar_t *wc, const char *s, size_t n);
  466.                 double wcstod  (const wchar_t *nptr, wchar_t **endptr);
  467.                 long   wcstol  (const wchar_t *nptr, wchar_t **endptr, int base);
  468.                 size_t wcstombs(char *s, const wchar_t *ws, size_t n);
  469.                 unsigned long wcstoul (const wchar_t *nptr, wchar_t **endptr, int base);
  470.                 int    wctomb  (char *s, wchar_t wchar);
  471.  
  472.    7. Formatted I/O Functions: 
  473.  
  474.  
  475.                 fscanf/scanf/sscanf with %ws, %wc decoding, and parameter
  476.                                     reordering via the (%n$x) format
  477.  
  478.                 fprintf/printf/sprintf with %ws, %wc encoding, and parameter
  479.                                        reordering via the (%n$x) format
  480.  
  481.    8. Collations: 
  482.  
  483.  
  484.                 int    strcoll(const char *s1, const char *s2);
  485.                 size_t strxfrm(char *s1, const char *s2, size_t n);
  486.  
  487.                 int    wcscoll(const wchar_t *ws1, const wchar_t *ws2);
  488.                 size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n);
  489.  
  490.    9. Date and Time Formatting: 
  491.  
  492.  
  493.                 size_t strftime (char *s, size_t maxsize, const char *format,
  494.                                  const struct tm *tm);
  495.  
  496.                 size_t strfmon  (char *s, size_t maxsize, const char *format, ...);
  497.  
  498.                 char  *strptime (const char *buf, const char *fmt, struct tm *tm);
  499.  
  500.                 size_t wcsftime (wchar_t *wcs, size_t maxsize, const char *format,
  501.                                  const struct tm *tm);
  502.  
  503.   10. Basic String manipulation API for wchar_t data type: 
  504.  
  505.  
  506.                 wchar_t *wcscat  (wchar_t       *string1, const wchar_t *string2);
  507.                 wchar_t *wcschr  (wchar_t       *string1, wint_t         wc);
  508.                 int      wcscmp  (const wchar_t *string1, const wchar_t *string2);
  509.                 wchar_t *wcscpy  (wchar_t       *string1, const wchar_t *string2);
  510.                 size_t   wcscspn (const wchar_t *string1, const wchar_t *string2);
  511.                 size_t   wcslen  (const wchar_t *ws);
  512.                 wchar_t *wcsncat (wchar_t       *string1, const wchar_t *string2, size_t n);
  513.                 int      wcsncmp (const wchar_t *string1, const wchar_t *string2, size_t n);
  514.                 wchar_t *wcsncpy (wchar_t       *string1, const wchar_t *string2, size_t n);
  515.                 wchar_t *wcspbrk (const wchar_t *string1, const wchar_t *string2);
  516.                 wchar_t *wcsrchr (wchar_t       *string1, wint_t         wc);
  517.                 size_t   wcsspn  (const wchar_t *string1, const wchar_t *string2);
  518.                 wchar_t *wcstok  (wchar_t       *string1, const wchar_t *string2);
  519.                 wchar_t *wcswcs  (const wchar_t *string1, const wchar_t *string2);
  520.                 int      wcswidth(wchar_t *ws, size_t n);
  521.                 char     wctype  (const char *charclass);
  522.                 int      wcwidth (wchar_t wc);
  523.  
  524.   11. Additional helper functions 
  525.  
  526.  
  527.                 double get_i18n_version(void);
  528.  
  529.  
  530. ΓòÉΓòÉΓòÉ 3. Locale Functions ΓòÉΓòÉΓòÉ
  531.  
  532. The locale functions are: 
  533.  
  534.  
  535.     char *setlocale(int category, const char *locale);
  536.     char *nl_langinfo(nl_item item);
  537.     struct lconv *localeconv(void);
  538.  
  539.  
  540. ΓòÉΓòÉΓòÉ 3.1. setlocale -- Defines/queries the program's locale ΓòÉΓòÉΓòÉ
  541.  
  542.  
  543. Syntax 
  544.  
  545. #include <locale.h>
  546.  
  547. char *setlocale(int category, const char *locale);
  548.  
  549.  
  550. Description 
  551.  
  552. By design, an application program initially starts up with a default locale. 
  553. This default locale is determined during the setloc1.dll initialization by 
  554. first mapping the current country code and code page to the set of installed 
  555. locales.  Then the LANG and LC_* environment variables are examined and if 
  556. present, override this first default. 
  557.  
  558. If a locale which uses code page 437 is not found, the US English 437 locale, 
  559. enus437, is used instead.  If a locale which uses code page 850 is not found, 
  560. the US English 850 locale, enus850, is used instead. 
  561.  
  562. If no suitable default locale can be found, the "C" locale is used. 
  563.  
  564. Most internationalized programs, however, must then change the locale for the 
  565. program to the locale set by the user.  This is done with a call to setlocale. 
  566. Upon calling the setlocale routine, the program's locale is again determined by 
  567. either the LANG, and LC_* environment variables, or directly by the 2nd 
  568. argument to setlocale. 
  569.  
  570.  
  571. Parameters 
  572.  
  573.  category      Specifies which locale categories to set.  Possible values are: 
  574.  
  575.                LC_ALL         All categories are affected. 
  576.  
  577.                LC_COLLATE     Affects behavior of the strcoll and strxfrm 
  578.                               functions. 
  579.  
  580.                LC_CTYPE       Affects behavior of the character handling 
  581.                               functions (See IS* functions) 
  582.  
  583.                LC_MESSAGES    Affects message information (See catgets 
  584.                               functions) 
  585.  
  586.                LC_MONETARY    Affects monetary information (See strfmon 
  587.                               functions) 
  588.  
  589.                LC_NUMERIC     Affects the decimal-point character for the 
  590.                               formatted input/output and string conversion 
  591.                               functions, and the nonmonetary formatting 
  592.                               information returned by the localeconv function. 
  593.  
  594.                LC_TIME        Affects behavior of the strftime function. 
  595.  
  596.  locale        Specifies which locale to use. 
  597.  
  598.                You can set the value to any valid locale. 
  599.  
  600.                To query what locale is currently active for a given category, 
  601.                specify NULL for the locale parameter. The setlocale function 
  602.                returns a pointer to the string associated with the specified 
  603.                category. The string can be used on a subsequent call to restore 
  604.                that part of the program's locale. 
  605.  
  606.                Note:  Because the string to which a successful call to 
  607.                setlocale points may be overwritten by subsequent calls to the 
  608.                setlocale function, you should copy the string if you plan to 
  609.                use it later. 
  610.  
  611.  
  612.  Return Values 
  613.  
  614.  On error, the setlocale function returns NULL and the program's locale is not 
  615.  changed. 
  616.  
  617.  
  618.  Related Information 
  619.  
  620.  Running samples of the setlocale function call can be found in most I18N 
  621.  programs.  The sample program setl demonstrates most of the uses of the 
  622.  setlocale function. 
  623.  
  624.  The following is a list of related functions and include files: 
  625.  
  626.      getenv  - Search for Environment Variables 
  627.      localeconv  - Query Locale Conventions 
  628.      _putenv - Modify Environent Variables 
  629.      locale.h - Contains definitions needed for setlocale 
  630.  
  631.  
  632.  Examples 
  633.  
  634.  This example sets the locale of the program equal to the session's locale and 
  635.  prints the string that is associated with the locale. 
  636.  
  637.   #include <stdio.h>
  638.   #include <wchar.h>
  639.   #include <locale.h>
  640.  
  641.   char *string;
  642.  
  643.   int main(void)
  644.   {
  645.                                           /* Inherit parent session's locale.  */
  646.     string = setlocale(LC_ALL, "");
  647.  
  648.                                           /* Query the state of the locale.    */
  649.                                           /* If it is returned, print it out.  */
  650.     string = setlocale(LC_ALL, NULL);
  651.     if (string != NULL)
  652.     {
  653.        printf(" %s \n",string);
  654.     }
  655.   }
  656.  
  657.  If LANG were set, for example, to En_US.IBM-437, then the program would 
  658.  display: 
  659.  
  660.  
  661.       ENUS437 ENUS437 ENUS437 ENUS437 ENUS437 ENUS437
  662.  
  663.  This example sets the LC_COLLATE category of the program's locale equal to the 
  664.  US English 850 locale and prints the string that is associated with the 
  665.  locale. 
  666.  
  667.   #include <stdio.h>
  668.   #include <wchar.h>
  669.   #include <locale.h>
  670.  
  671.   char *string;
  672.  
  673.   int main(void)
  674.   {
  675.     string = setlocale(LC_COLLATE, "En_US.IBM-850");
  676.  
  677.     string = setlocale(LC_ALL, NULL);
  678.     if (string != NULL)
  679.     {
  680.        printf(" %s \n",string);
  681.     }
  682.   }
  683.  
  684.  If LANG were set, for example, to En_US.IBM-437, then the program would 
  685.  display: 
  686.  
  687.  
  688.       ENUS437 ENUS437 ENUS850 ENUS437 ENUS437 ENUS437
  689.  
  690.  This example sets all of the locale settings (categories) based on the 
  691.  environment variables.  This is the usual form of the setlocal call in your 
  692.  programs. 
  693.  
  694.   #include <wchar.h>
  695.   #include <locale.h>
  696.  
  697.   void main(void)
  698.   {
  699.     setlocale(LC_ALL, "");
  700.   }
  701.  
  702.  
  703. ΓòÉΓòÉΓòÉ 3.2. nl_langinfo -- Retrieves information from locale ΓòÉΓòÉΓòÉ
  704.  
  705.  
  706. Syntax 
  707.  
  708. #include <langinfo.h>
  709.  
  710. char *nl_langinfo(nl_item item);
  711.  
  712. Description 
  713.  
  714. The function nl_langinfo returns a pointer to a string containing information 
  715. relevent to the language or cultural area defined in the program's locale. 
  716. This string should not be modified by the calling program.  Calls to the 
  717. setlocale function may also modify the string. 
  718.  
  719.  
  720. Parameters 
  721.  
  722.  item      Identifies specific information being requested. The values for item 
  723.            are defined in the file langinfo.h.  A list of the possible values 
  724.            follows: 
  725.  
  726.  
  727.            D_T_FMT          string for formatting date and time 
  728.            D_FMT            string for formatting date 
  729.            T_FMT            string for formatting time 
  730.            AM_STR           string for a.m. 
  731.            PM_STR           string for p.m. 
  732.            ABDAY_1          abbreviated first day of the week (Sun) 
  733.            ABDAY_2          abbreviated second day of the week (Mon) 
  734.            ABDAY_3          abbreviated third day of the week (Tue) 
  735.            ABDAY_4          abbreviated fourth day of the week (Wed) 
  736.            ABDAY_5          abbreviated fifth day of the week (Thu) 
  737.            ABDAY_6          abbreviated sixth day of the week (Fri) 
  738.            ABDAY_7          abbreviated seventh day of the week (Sat) 
  739.            DAY_1            name of the first day of the week (Sunday) 
  740.            DAY_2            name of the second day of the week (Monday) 
  741.            DAY_3            name of the third day of the week (Tuesday) 
  742.            DAY_4            name of the fourth day of the week (Wednesday) 
  743.            DAY_5            name of the fifth day of the week (Thursday) 
  744.            DAY_6            name of the sixth day of the week (Friday) 
  745.            DAY_7            name of the seventh day of the week (Saturday) 
  746.            ABMON_1          abbreviated first month (Jan) 
  747.            ABMON_2          abbreviated second month (Feb) 
  748.            ABMON_3          abbreviated third month (Mar) 
  749.            ABMON_4          abbreviated fourth month (Apr) 
  750.            ABMON_5          abbreviated fifth month (May) 
  751.            ABMON_6          abbreviated sixth month (Jun) 
  752.            ABMON_7          abbreviated seventh month (Jul) 
  753.            ABMON_8          abbreviated eighth month (Aug) 
  754.            ABMON_9          abbreviated ninth month (Sep) 
  755.            ABMON_10         abbreviated tenth month (Oct) 
  756.            ABMON_11         abbreviated eleventh month (Nov) 
  757.            ABMON_12         abbreviated twelveth month (Dec) 
  758.            MON_1            name of the first month (January) 
  759.            MON_2            name of the second month (February) 
  760.            MON_3            name of the third month (March) 
  761.            MON_4            name of the fourth month (April) 
  762.            MON_5            name of the fifth month (May) 
  763.            MON_6            name of the sixth month (June) 
  764.            MON_7            name of the seventh month (July) 
  765.            MON_8            name of the eighth month (August) 
  766.            MON_9            name of the ninth month (September) 
  767.            MON_10           name of the tenth month (October) 
  768.            MON_11           name of the eleventh month (November) 
  769.            MON_12           name of the twelveth month (December) 
  770.            RADIXCHAR        radix character 
  771.            THOUSEP          separator for thousands 
  772.            YESSTR           affirmative response for yes/no queries 
  773.            NOSTR            negative response for yes/no queries 
  774.            CRNCYSTR         currency symbol; - leading, + trailing 
  775.            CODESET          codeset name 
  776.  
  777.  
  778.  Return Values 
  779.  
  780.  Returns string containing requested information or a pointer to an empty 
  781.  string if an error occurs. 
  782.  
  783.  
  784.  Related Information 
  785.  
  786.      langinfo.h 
  787.  
  788.  
  789.  Example 
  790.  
  791.  This program queries the current locale for the string which defines the 
  792.  parameter DAY_5 and ABMON_10. 
  793.  
  794.   #include <stdlib.h>
  795.   #include <stdio.h>
  796.   #include <langinfo.h>
  797.   #include <wchar.h>
  798.   #include <locale.h>
  799.  
  800.   int main (void) {
  801.       printf("\nCalling setlocale\n");
  802.       printf("Setlocale returns: %s \n", setlocale(LC_ALL, ""));
  803.  
  804.       printf("My Kingdom for a Day and a Month : %s %s",
  805.       nl_langinfo(DAY_5),nl_langinfo(ABMON_10));
  806.  
  807.       return(1);
  808.       }
  809.  
  810.  
  811. ΓòÉΓòÉΓòÉ 3.3. localeconv -- Determine program locale ΓòÉΓòÉΓòÉ
  812.  
  813.  
  814. Syntax 
  815.  
  816. #include <locale.h>
  817. #include <wchar.h>
  818.  
  819. struct lconv *localeconv(void);
  820.  
  821. Description 
  822.  
  823. The localeconv function sets the components of a structure, struct lconv, to 
  824. values appropriate for the current locale.  The structure may be overwritten by 
  825. another call to localeconv or by calling setlocale and passing LC_ALL, 
  826. LC_MONETARY, or LC_NUMERIC. 
  827.  
  828. The structure contains the following elements (defaults shown are for the C 
  829. locale): 
  830.  
  831. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  832. ΓöéELEMENT                ΓöéPURPOSE                            ΓöéDEFAULT    Γöé
  833. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  834. Γöéchar *decimal_point    ΓöéRadix character used to format     Γöé"."        Γöé
  835. Γöé                       Γöénon-monetary quantities.           Γöé           Γöé
  836. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  837. Γöéchar *thousands_sep    ΓöéCharacter used to separate groups  Γöé""         Γöé
  838. Γöé                       Γöéof digits to the left of the       Γöé           Γöé
  839. Γöé                       Γöédecimal point character in         Γöé           Γöé
  840. Γöé                       Γöéformatted nonmonetary quantities.  Γöé           Γöé
  841. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  842. Γöéchar *grouping         ΓöéString whose elements taken as     Γöé""         Γöé
  843. Γöé                       Γöéone-byte integer values indicate   Γöé           Γöé
  844. Γöé                       Γöéthe size of each group of digits inΓöé           Γöé
  845. Γöé                       Γöéformatted non-monetary quantities. Γöé           Γöé
  846. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  847. Γöéchar *int_curr_symbol  ΓöéInternational currency symbol for  Γöé""         Γöé
  848. Γöé                       Γöéthe current locale.  The first     Γöé           Γöé
  849. Γöé                       Γöéthree characters contain the       Γöé           Γöé
  850. Γöé                       Γöéalphabetic international currency  Γöé           Γöé
  851. Γöé                       Γöésymbol.  The fourth character      Γöé           Γöé
  852. Γöé                       Γöé(usually a space) is the character Γöé           Γöé
  853. Γöé                       Γöéused to separate the international Γöé           Γöé
  854. Γöé                       Γöécurrency symbol from the monetary  Γöé           Γöé
  855. Γöé                       Γöéquantity.                          Γöé           Γöé
  856. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  857. Γöéchar *currency_symbol  ΓöéLocal currency symbol of the       Γöé""         Γöé
  858. Γöé                       Γöécurrent locale.                    Γöé           Γöé
  859. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  860. Γöéchar *mon-decimal_pointΓöéRadix character used to format     Γöé"."        Γöé
  861. Γöé                       Γöémonetary quantities.               Γöé           Γöé
  862. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  863. Γöéchar *mon_thousands_sepΓöéSeparator for digits in formatted  Γöé""         Γöé
  864. Γöé                       Γöémonetary quantities.               Γöé           Γöé
  865. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  866. Γöéchar *mon_grouping     ΓöéString whose elements taken as     Γöé""         Γöé
  867. Γöé                       Γöéone-byte integer values indicate   Γöé           Γöé
  868. Γöé                       Γöéthe size of each group of digits inΓöé           Γöé
  869. Γöé                       Γöéformatted monetary quantities.     Γöé           Γöé
  870. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  871. Γöéchar *positive_sign    ΓöéString indicating a positive value Γöé           Γöé
  872. Γöé                       Γöéformatted monetary quantity.       Γöé           Γöé
  873. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  874. Γöéchar *negative_sign    ΓöéString indicating a negative value Γöé           Γöé
  875. Γöé                       Γöéformatted monetary quantity.       Γöé           Γöé
  876. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  877. Γöéchar int_frac_digits   ΓöéThe number of displayed digits to  Γöé"UCHAR_MAX"Γöé
  878. Γöé                       Γöéthe right of the decimal place for Γöé           Γöé
  879. Γöé                       Γöéinternationally formatted monetary Γöé           Γöé
  880. Γöé                       Γöéquantities.                        Γöé           Γöé
  881. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  882. Γöéchar frac_digits       ΓöéNumber of digits to the right of   Γöé"UCHAR_MAX"Γöé
  883. Γöé                       Γöéthe decimal place in monetary      Γöé           Γöé
  884. Γöé                       Γöéquantities.                        Γöé           Γöé
  885. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  886. Γöéchar p_cs_precedes     Γöé1 if the "currency_symbol" or      Γöé"UCHAR_MAX"Γöé
  887. Γöé                       Γöéint_curr_symbol precedes the value Γöé           Γöé
  888. Γöé                       Γöéfor a non-negative formatted       Γöé           Γöé
  889. Γöé                       Γöémonetary quantity; 0 if it succedesΓöé           Γöé
  890. Γöé                       Γöéthe value.                         Γöé           Γöé
  891. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  892. Γöéchar p_sep_by_space    Γöé0 if the "currency_symbol" or      Γöé"UCHAR_MAX"Γöé
  893. Γöé                       Γöéint_curr_symbol is not separated byΓöé           Γöé
  894. Γöé                       Γöéa from the value for a non-negativeΓöé           Γöé
  895. Γöé                       Γöéformatted space monetary quantity; Γöé           Γöé
  896. Γöé                       Γöé1 if a space separates the symbol  Γöé           Γöé
  897. Γöé                       Γöéfrom the value; and 2 if a space   Γöé           Γöé
  898. Γöé                       Γöéseparates the symbol and the sign  Γöé           Γöé
  899. Γöé                       Γöéstring, if adjacent.               Γöé           Γöé
  900. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  901. Γöéchar n_cs_precedes     Γöé1 if the "currency_symbol" or      Γöé"UCHAR_MAX"Γöé
  902. Γöé                       Γöéint_curr_symbol precedes the value Γöé           Γöé
  903. Γöé                       Γöéfor a negative formatted monetary  Γöé           Γöé
  904. Γöé                       Γöéquantity; 0 if it succedes the     Γöé           Γöé
  905. Γöé                       Γöévalue.                             Γöé           Γöé
  906. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  907. Γöéchar n_sep_by_space    Γöé0 if the "currency_symbol" or      Γöé"UCHAR_MAX"Γöé
  908. Γöé                       Γöéint_curr_symbol is not separated byΓöé           Γöé
  909. Γöé                       Γöéa space from the  value for a      Γöé           Γöé
  910. Γöé                       Γöénegative formatted monetary        Γöé           Γöé
  911. Γöé                       Γöéquantity;  1 if a space separates  Γöé           Γöé
  912. Γöé                       Γöéthe symbol  from the value; and 2  Γöé           Γöé
  913. Γöé                       Γöéif a space separates the symbol andΓöé           Γöé
  914. Γöé                       Γöéthe sign string, if adjacent.      Γöé           Γöé
  915. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  916. Γöéchar p_sign_posn       ΓöéValue indicating the position of   Γöé           Γöé
  917. Γöé                       Γöéthe "positive_sign" for a          Γöé           Γöé
  918. Γöé                       Γöénon-negative formatted monetary    Γöé           Γöé
  919. Γöé                       Γöéquantity.                          Γöé           Γöé
  920. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  921. Γöéchar n_sign_posn       ΓöéValue indicating the position of   Γöé           Γöé
  922. Γöé                       Γöéthe "negative_sign" for a negative Γöé           Γöé
  923. Γöé                       Γöéformatted monetary quantity.       Γöé           Γöé
  924. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  925. Γöéchar *left_parenthesis ΓöéCharacter that appears on left sideΓöé""         Γöé
  926. Γöé                       Γöéof negative currency amount.       Γöé           Γöé
  927. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  928. Γöéchar *right_parenthesisΓöéCharacter that appears on right    Γöé""         Γöé
  929. Γöé                       Γöéside of negative currency amount.  Γöé           Γöé
  930. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  931.  
  932. The n_sign_posn and p_sign_posn elements can have the following values: 
  933.  
  934.  Value       Meaning 
  935.  0           Parentheses surround the quantity and currency_symbol or 
  936.              int_curr_symbol. 
  937.  1           The sign precedes the quantity and currency_symbol or 
  938.              int_curr_symbol. 
  939.  2           The sign follows the quantity and currency_symbol or 
  940.              int_curr_symbol. 
  941.  3           The sign precedes the currency_symbol or int_curr_symbol. 
  942.  4           The sign follows the currency_symbol or int_curr_symbol. 
  943.  
  944.  
  945.  Return Values 
  946.  
  947.  The localeconv function returns a pointer to the structure. 
  948.  
  949.  
  950.  Related Information 
  951.  
  952.      setlocale - Set Locale 
  953.      locale.h 
  954.  
  955.  Example 
  956.  
  957.  This example prints out the default decimal point for your locale and then the 
  958.  decimal point for the Fr_FR locale. 
  959.  
  960.   #include <stdio.h>
  961.   #include <wchar.h>
  962.   #include <locale.h>
  963.  
  964.   int main(void) {
  965.       char * string;
  966.       struct lconv * mylocale;
  967.       mylocale = localeconv();
  968.       /* Default decimal point */
  969.       printf( "Default decimal point is a %s\n",
  970.            mylocale->decimal_point );
  971.  
  972.       string = setlocale(LC_ALL,"Fr_FR");
  973.       mylocale = localeconv();
  974.  
  975.       /*****************************************
  976.       * A comma is set to be the decimal point *
  977.       * when the locale is LC_FRANCE           *
  978.       *****************************************/
  979.  
  980.       printf( "France's decimal point is a %s\n", mylocale->decimal_point );
  981.       }
  982.  
  983.   /****************  Output should be similar to:  ******************
  984.  
  985.   Default decimal point is a .
  986.   France's decimal point is a ,
  987.  
  988.   *******************************************************************/
  989.  
  990.  
  991. ΓòÉΓòÉΓòÉ 4. Message Catalog Functions ΓòÉΓòÉΓòÉ
  992.  
  993. The message catalog functions are: 
  994.  
  995.  
  996.     nl_catd   catopen(const char *name, int oflag);
  997.     char     *catgets(nl_catd catd, int set_id, int msg_id, const char *s);
  998.     int       catclose(nl_catd catd);
  999.  
  1000.  
  1001. ΓòÉΓòÉΓòÉ 4.1. catopen -- Opens a specified message catalog ΓòÉΓòÉΓòÉ
  1002.  
  1003.  
  1004. Syntax 
  1005.  
  1006.  
  1007. #include <nl_types.h>
  1008.  
  1009. nl_catd catopen(const char *name, int oflag);
  1010.  
  1011.  
  1012. Description 
  1013.  
  1014. The catopen function opens a specified message catalog and returns a catalog 
  1015. descriptor used to retrieve messages from the catalog. The contents of the 
  1016. catalog descriptor are complete when the catgets function accesses the message 
  1017. catalog.  The nl_catd data type is used for catalog descriptors.  This data 
  1018. type is defined in the nl_types.h file. 
  1019.  
  1020. If the catalog file name referred to by the name parameter contains a drive 
  1021. letter or a leading \, it is assumed to be an absolute pathname. That is, the 
  1022. catalog is looked for following that path.  If the name specified is not an 
  1023. absolute path name, the user environment determines which directory paths to 
  1024. search.  The NLSPATH environment variable defines the directory search path. 
  1025. When this variable is used, the setlocale function must be called before the 
  1026. catopen function. 
  1027.  
  1028. You can use two special variables, %N and %L, in the NLSPATH environment 
  1029. variable.  The %N variable is replaced by the catalog name referred to by the 
  1030. call that opens the message catalog.  The %L variable is replaced by the value 
  1031. of the LC_MESSAGES category. 
  1032.  
  1033. The value of the LC_MESSAGES category can be set by specifying values for the 
  1034. LANG, LC_ALL, or LC_MESSAGES environment variable.  The value of the 
  1035. LC_MESSAGES category indicates which locale specific directory to search for 
  1036. message catalogs.  For example, if the catopen function specifies a catalog 
  1037. with the name mycmd, and the environment variables are set as follows: 
  1038.  
  1039.     NLSPATH=..\%N:.\%N:\system\nls\%L\%N:\system\nls\%N
  1040.     LANG=Fr_fr.IBM-850
  1041.  
  1042. then the application searches for the catalog in the following order: 
  1043.  
  1044.      ..\mycmd 
  1045.  
  1046.      .\mycmd 
  1047.  
  1048.      \system/\ls\FRFR850\mycmd 
  1049.  
  1050.      \system\nls\mycmd 
  1051.  
  1052.  If you omit the %N variable in a directory specification within the NLSPATH 
  1053.  environment variable, the application assumes that the path defines a 
  1054.  directory and searches for the catalog in that directory before searching the 
  1055.  next specified path. 
  1056.  
  1057.  If the NLSPATH environment variable is not defined, the current directory is 
  1058.  used.  If the LC_MESSAGES category is set to the C locale (LC_MESSAGES=C), 
  1059.  then the NLSPATH variable mechanism is disabled.  Subsequent calls to the 
  1060.  catgets function generate pointers to the program-supplied default text. 
  1061.  
  1062.  
  1063.  Parameters 
  1064.  
  1065.  name          Specifies the catalog file to open. 
  1066.  
  1067.  oflag         Designates how the message catalog is located. 
  1068.  
  1069.                0              The LANG environment variable is used to locate 
  1070.                               the message catalog without regard to the 
  1071.                               LC_MESSAGES category. 
  1072.  
  1073.                NL_CAT_LOCALE  The LC_MESSAGES category is used to locate the 
  1074.                               message catalog. 
  1075.  
  1076.  
  1077.  Return Values 
  1078.  
  1079.  Successful     A catalog descriptor is returned. 
  1080.  
  1081.  Error 
  1082.  
  1083.                 CATD_ERR (-1)        Returned if the LC_MESSAGES category is 
  1084.                                      set to the "C" locale or if an error 
  1085.                                      occurred during the creation of the 
  1086.                                      nl_catd structure. 
  1087.  
  1088.  
  1089.  Related Information 
  1090.  
  1091.      setlocale - Set a locale. 
  1092.      catgets - Read a message. 
  1093.      catclose - Close a message catalog file. 
  1094.  
  1095.  
  1096.  Example 
  1097.  
  1098.   #include <stdio.h>
  1099.   #include <nl_types.h>
  1100.  
  1101.   void load_cat(char *tcat)
  1102.   {
  1103.     nl_catd catd;                         /* Catalog descriptor.               */
  1104.  
  1105.     if ((catd = catopen(tcat, 0)) == CATD_ERR)
  1106.     {
  1107.        printf("Unable to load specified catalog. \n");
  1108.        exit(1);
  1109.     }
  1110.  
  1111.     if (catclose(catd) == -1)
  1112.        printf("Error when trying to close catalog file\n");
  1113.  
  1114.   }
  1115.  
  1116.  
  1117. ΓòÉΓòÉΓòÉ 4.2. catgets -- Retrieves a message from a catalog ΓòÉΓòÉΓòÉ
  1118.  
  1119.  
  1120. Syntax 
  1121.  
  1122. #include <nl_types.h>
  1123.  
  1124. char *catgets(nl_catd catd, int set_id, int msg_id, const char *s);
  1125.  
  1126.  
  1127. Description 
  1128.  
  1129. The catgets function retrieves a message from a catalog and constructs a 
  1130. message based on the set_id + msg_id + message. If the catgets function finds 
  1131. the specified message, it loads it into an internal character string buffer, 
  1132. ends the message string with a null character, and returns a pointer to the 
  1133. buffer. 
  1134.  
  1135. The returned pointer is used to reference the buffer and display the message. 
  1136. However, the buffer can not be referenced after the catalog is closed. 
  1137.  
  1138.  
  1139. Parameters 
  1140.  
  1141.  catd      Specifies the open catalog to use for message retrieval.  This is 
  1142.            the catalog descriptor returned on the catopen call. 
  1143.  
  1144.  set_id    Specifies the set ID of the message. 
  1145.  
  1146.  msg_id    Specifies the message ID of the message.  The set_id and msg_id 
  1147.            parameters specify a particular message in the catalog to retrieve. 
  1148.  
  1149.  s         Specifies the default character-string buffer to use if the message 
  1150.            is not retrieved from the catalog. 
  1151.  
  1152.  
  1153.  Return Value 
  1154.  
  1155.  Successful Retrieved message is returned. 
  1156.  
  1157.  Error      The user-supplied default message string specified by the s 
  1158.             parameter is returned. 
  1159.  
  1160.  
  1161.  Related Information 
  1162.  
  1163.      catopen - Open a message catalog. 
  1164.      catclose - Close a message catalog file. 
  1165.      wchar.h - Header file for message functions. 
  1166.  
  1167.  
  1168.  Example 
  1169.  
  1170.  This example opens a message file with the name contained in tcat and prints 
  1171.  out the message associated with set number in setno and the message number in 
  1172.  msgno. 
  1173.  
  1174.   #include <stdio.h>
  1175.   #include <nl_types.h>
  1176.  
  1177.   char *catg(char *tcat, int setno, int msgno, char *def)
  1178.   {
  1179.       nl_catd catd;                       /* Catalog descriptor.               */
  1180.       char cat[PATH_MAX];
  1181.  
  1182.       if ((catd = catopen(tcat, 0)) == CATD_ERR)
  1183.       {
  1184.          printf("Unable to load specified catalog. \n");
  1185.          exit (1);
  1186.       }
  1187.  
  1188.       printf("ERROR MESSAGE : %s\n",
  1189.              catgets(catd, setno, msgno, def));
  1190.  
  1191.       if (catclose(catd) == -1)
  1192.          perror("Error when trying to close catalog file");
  1193.  
  1194.   }
  1195.  
  1196.  
  1197. ΓòÉΓòÉΓòÉ 4.3. catclose -- Closes a specified message catalog ΓòÉΓòÉΓòÉ
  1198.  
  1199.  
  1200. Syntax 
  1201.  
  1202. #include <nl_types.h>
  1203.  
  1204. int catclose(nl_catd catd);
  1205.  
  1206.  
  1207. Description 
  1208.  
  1209. The function catclose is used to close a message catalog that was previously 
  1210. opened by catopen. 
  1211.  
  1212.  
  1213. Parameters 
  1214.  
  1215.  catd      Catalog descriptor returned by catopen. 
  1216.  
  1217.  
  1218.  Return Value 
  1219.  
  1220.  0         Successful 
  1221.  -1        Close failed. 
  1222.  
  1223.  Related Information 
  1224.  
  1225.      catopen - Open a message catalog. 
  1226.      catgets - Read a message from the message catalog. 
  1227.      nl_types.h - header file for message functions. 
  1228.  
  1229.  
  1230.  Example 
  1231.  
  1232.  This example opens and closes a catalog message file. 
  1233.  
  1234.   #include <stdio.h>
  1235.   #include <nl_types.h>
  1236.  
  1237.   void load_cat(char *tcat)
  1238.   {
  1239.     nl_catd catd;
  1240.  
  1241.     if ((catd = catopen(tcat, 0)) == CATD_ERR)
  1242.     {
  1243.        printf("Unable to load specified catalog. \n");
  1244.        exit (1);
  1245.     }
  1246.  
  1247.     if (catclose(catd) == -1)
  1248.        printf("Error when trying to close catalog file");
  1249.  
  1250.   }
  1251.  
  1252.  
  1253. ΓòÉΓòÉΓòÉ 5. File I/O Functions ΓòÉΓòÉΓòÉ
  1254.  
  1255. The File I/O functions are: 
  1256.  
  1257.  
  1258.     wint_t   fgetwc(FILE *stream);
  1259.     wint_t   fputwc(const wint_t wc, FILE *stream);
  1260.  
  1261.     wchar_t *fgetws(wchar_t *s, int n, FILE *stream);
  1262.     int      fputws(const wchar_t *s, FILE *stream);
  1263.  
  1264.     wint_t   getwc(FILE *stream);
  1265.     wint_t   putwc(wint_t c, FILE *stream);
  1266.     wint_t   ungetwc(wint_t c, FILE *stream);
  1267.  
  1268.     wint_t   getwchar(void);
  1269.     wint_t   putwchar(wint_t c);
  1270.  
  1271.     int      getw(register FILE *stream);
  1272.     int      putw(int w, register FILE *stream);
  1273.  
  1274.  
  1275. ΓòÉΓòÉΓòÉ 5.1. fgetwc -- Read a wide-character from a stream ΓòÉΓòÉΓòÉ
  1276.  
  1277.  
  1278. Syntax 
  1279.  
  1280. #include <stdio.h>
  1281. #include <wchar.h>
  1282.  
  1283. wint_t fgetwc(FILE *stream);
  1284.  
  1285. Description 
  1286.  
  1287. The fgetwc function reads a single character from the input stream at the 
  1288. current position, converts it to the corresponding wide character and advances 
  1289. the associated file pointer, if any, so that it points to the next character. 
  1290.  
  1291.  
  1292. Parameters 
  1293.  
  1294.  stream    Input stream from which character is to be retrieved. 
  1295.  
  1296.  
  1297.  Return Values 
  1298.  
  1299.  wint_t 
  1300.  
  1301.            WEOF           An error or an end-of-file condition occurred. Use 
  1302.                           feof or ferror to determine whether the WEOF value 
  1303.                           indicates an error or the end of the file. 
  1304.  
  1305.            Other          The character read in wide-character format. 
  1306.  
  1307.  
  1308.  Related Information 
  1309.  
  1310.      feof   - Test End-of-File Indicator 
  1311.      ferror  - Test for Read/Write Errors 
  1312.      fopen  - Open File 
  1313.      wchar.h - Include file for the wide-character functions. 
  1314.  
  1315.  Example 
  1316.  
  1317.  This example gathers a single line of input from a stream. 
  1318.  
  1319.   #include <stdio.h>
  1320.   #include <wchar.h>
  1321.   #define  MAX_LEN  26
  1322.  
  1323.   int main(void)
  1324.   {
  1325.     FILE *stream;
  1326.     wchar_t buffer[MAX_LEN + 1];
  1327.     size_t i;
  1328.     wint_t ch;
  1329.  
  1330.     stream = fopen("myfile.dat", "r");
  1331.  
  1332.     for (i = 0; ((i < MAX_LEN) &&
  1333.                  ((ch =  fgetwc(stream)) != WEOF) &&
  1334.                  (ch != '\n')); i++)
  1335.     {
  1336.         buffer[i] = ch;
  1337.     }
  1338.  
  1339.     buffer[i] = NULL;
  1340.  
  1341.     printf("%S", buffer);
  1342.  
  1343.     if (fclose(stream))
  1344.        perror("fclose error");
  1345.   }
  1346.  
  1347.   /***************  If myfile.dat contains  ********************
  1348.  
  1349.            ABCDEFGHIJKLMNOPQRSTUVWXYZ1000000A0.013400
  1350.  
  1351.   *******************  expected output is:  ********************
  1352.  
  1353.   ABCDEFGHIJKLMNOPQRSTUVWXYZ
  1354.  
  1355.  
  1356. ΓòÉΓòÉΓòÉ 5.2. fputwc -- Write a wide-character to a stream ΓòÉΓòÉΓòÉ
  1357.  
  1358.  
  1359. Syntax 
  1360.  
  1361. #include <stdio.h>
  1362. #include <wchar.h>
  1363.  
  1364. wint_t fputwc(const wint_t wc, FILE *stream);
  1365.  
  1366. Description 
  1367.  
  1368. The fputwc function converts the wide-character wc to a multibyte character and 
  1369. then writes the multibyte character to the output stream at the current 
  1370. position and advances the file position appropriately. If the stream is opened 
  1371. with one of the append modes, the character is appended to the end of the 
  1372. stream. 
  1373.  
  1374.  
  1375. Parameters 
  1376.  
  1377.  wc        wide-character to be written. 
  1378.  
  1379.  stream    Output stream into which the character is to be written. 
  1380.  
  1381.  
  1382.  Return Values 
  1383.  
  1384.  wint_t 
  1385.  
  1386.            WEOF           An error occurred. 
  1387.  
  1388.            Other          The character that was written. 
  1389.  
  1390.  
  1391.  Related Information 
  1392.  
  1393.      fgetwc  - Read a wide-character. 
  1394.      putwc  - Write a wide-character. 
  1395.      wchar.h -  Header file for wide-character prototypes. 
  1396.  
  1397.  Example 
  1398.  
  1399.  This example writes the contents of buffer to a file called myfile.dat. 
  1400.  
  1401.   #include <stdio.h>
  1402.   #include <wchar.h>
  1403.   #define NUM_ALPHA  80
  1404.  
  1405.   int main(void)
  1406.   {
  1407.     FILE * stream;
  1408.     int i;
  1409.     wint_t ch;
  1410.  
  1411.     wchar_t buffer[NUM_ALPHA];
  1412.  
  1413.     mbstowcs(buffer, "abcdefghijklmnopqrstuvwxyz", NUM_ALPHA);
  1414.  
  1415.     if   ((stream = fopen("myfile.dat", "w")) != NULL)
  1416.     {
  1417.          for (i=0; i < (int) wcslen(buffer); ++i)
  1418.              ch=fputwc(buffer[i], stream);
  1419.          fclose( stream );
  1420.     }
  1421.     else printf("Error opening myfile.dat");
  1422.  
  1423.   }
  1424.  
  1425.  
  1426. ΓòÉΓòÉΓòÉ 5.3. fgetws -- Read wide-character string from a stream ΓòÉΓòÉΓòÉ
  1427.  
  1428.  
  1429. Syntax 
  1430.  
  1431. #include <stdio.h>
  1432. #include <wchar.h>
  1433.  
  1434. wchar_t *fgetws (wchar_t *ws, int n, FILE *stream);
  1435.  
  1436. Description 
  1437.  
  1438. The fgetws function reads characters from the current stream position up to and 
  1439. including the first new-line character (\n), up to the end of the stream, or 
  1440. until the number of characters read is equal to n-1, whichever comes first. It 
  1441. converts each character to its corresponding wide-character, stores the result 
  1442. in the string pointed to by ws and adds a null character (\0) to the end of the 
  1443. string.  The string includes the new-line character, if read.  If n is equal to 
  1444. 1, the string contains a wide-character new-line only. 
  1445.  
  1446.  
  1447. Parameters 
  1448.  
  1449.  ws        Points to a wchar_t array into which the wide-characters will be 
  1450.            placed. 
  1451.  
  1452.  n         The maximum number of wide-characters to return including the NULL 
  1453.            terminator. 
  1454.  
  1455.  stream    Input stream from which the characters are to be retrieved. 
  1456.  
  1457.  
  1458.  Return Values 
  1459.  
  1460.  wchar_t * 
  1461.  
  1462.            NULL           An error or an end-of-file condition occurred. Use 
  1463.                           feof or ferror to determine whether the WEOF value 
  1464.                           indicates an error or the end of the file. In either 
  1465.                           case, the value of the string is unchanged. 
  1466.  
  1467.            Other          A pointer to the string containing the 
  1468.                           wide-characters. 
  1469.  
  1470.  
  1471.  Related Information 
  1472.  
  1473.      feof   - Test End-of-File Indicator. 
  1474.      ferror  - Test for Read/Write Errors. 
  1475.      fputws  - Print Strings. 
  1476.      wchar.h - Include file for the wide-character functions. 
  1477.  
  1478.  Example 
  1479.  
  1480.  This example gets a line of input from a data stream. The example reads no 
  1481.  more than MAX_LEN - 1 characters, or up to a new-line character, from the 
  1482.  stream. 
  1483.  
  1484.   #include <stdio.h>
  1485.   #include <wchar.h>
  1486.   #define  MAX_LEN  27
  1487.  
  1488.   int main(void)
  1489.   {
  1490.     FILE *stream;
  1491.     wchar_t line[MAX_LEN], *result;
  1492.  
  1493.     stream = fopen("myfile.dat", "rb");
  1494.  
  1495.     if ((result = fgetws(line, MAX_LEN, stream)) != NULL)
  1496.        printf("The string is %S\n", result);
  1497.  
  1498.     if (fclose(stream))
  1499.        perror("fclose error");
  1500.   }
  1501.  
  1502.   ****************  If myfile.dat contains  ********************
  1503.  
  1504.            ABCDEFGHIJKLMNOPQRSTUVWXYZ1000000A0.013400
  1505.  
  1506.   *******************  expected output is:  ********************
  1507.  
  1508.   The string is ABCDEFGHIJKLMNOPQRSTUVWXYZ
  1509.  
  1510.  
  1511. ΓòÉΓòÉΓòÉ 5.4. fputws -- Write wide-character string to a stream ΓòÉΓòÉΓòÉ
  1512.  
  1513.  
  1514. Syntax 
  1515.  
  1516. #include <stdio.h>
  1517. #include <wchar.h>
  1518.  
  1519. int fputws(const wchar_t *string, FILE *stream);
  1520.  
  1521. Description 
  1522.  
  1523. The fputws function copies string to the output stream at the current position. 
  1524. It does not copy the NULL character (\0) at the end of the string.  The 
  1525. wide-characters contained in string are converted to their corresponding 
  1526. multibyte characters. 
  1527.  
  1528.  
  1529. Parameters 
  1530.  
  1531.  string    Address of a null terminated wide-character string. 
  1532.  
  1533.  stream    Output stream into which the string is to be written. 
  1534.  
  1535.  
  1536.  Return Values 
  1537.  
  1538.  wint_t 
  1539.  
  1540.            -1                        An error occurred. 
  1541.  
  1542.            Non negative number       The number of bytes written to the output 
  1543.                                      stream. 
  1544.  
  1545.  
  1546.  Related Information 
  1547.  
  1548.      fgetws - Read a String 
  1549.      wchar.h - Header file for wide-character prototypes. 
  1550.  
  1551.  Example 
  1552.  
  1553.  This example writes a wide-character string to a stream. 
  1554.  
  1555.   #include <stdio.h>
  1556.   #include <wchar.h>
  1557.   #define NUM_ALPHA  80
  1558.  
  1559.   int main(void)
  1560.   {
  1561.     FILE * stream;
  1562.     int num;
  1563.     wint_t ch;
  1564.  
  1565.     wchar_t buffer[NUM_ALPHA];
  1566.  
  1567.     mbstowcs(buffer,"abcdefghijklmnopqrstuvwxyz", NUM_ALPHA);
  1568.  
  1569.     if   ((stream=fopen("myfile.dat", "w")) != NULL)
  1570.     {
  1571.          num =fputws(buffer, stream);
  1572.          printf("Total number of characters written to file = %i\n", num);
  1573.          fclose(stream);
  1574.     }
  1575.     else printf("Error opening myfile.dat");
  1576.   }
  1577.  
  1578.  
  1579. ΓòÉΓòÉΓòÉ 5.5. getwc -- Read a wide-character from a stream ΓòÉΓòÉΓòÉ
  1580.  
  1581.  
  1582. Syntax 
  1583.  
  1584. #include <sdtio.h>
  1585. #include <wchar.h>
  1586.  
  1587.     wint_t getwc(FILE *stream);
  1588.  
  1589. Description. 
  1590.  
  1591. This function is equivalent to the fgetwc function.  See the fgetwc function 
  1592. description. 
  1593.  
  1594.  
  1595. Parameters. 
  1596.  
  1597. Please refer to fgetwc. 
  1598.  
  1599.  
  1600. Return Values 
  1601.  
  1602. Please refer to fgetwc. 
  1603.  
  1604.  
  1605. Example 
  1606.  
  1607. This example gets a line of input from the stdin stream. You can also use 
  1608. getwc(stdin) instead of getchar() in the for statement to get a line of input 
  1609. from stdin. 
  1610.  
  1611. #include <stdio.h>
  1612. #include <wchar.h>
  1613. #define LINE 80
  1614.  
  1615. int main(void)
  1616. {
  1617.   wchar_t buffer[LINE+1];
  1618.   int i;
  1619.   wint_t ch;
  1620.  
  1621.   printf("Please enter string\n");
  1622.  
  1623.                                         /* Keep reading until either:
  1624.                                            1. the length of LINE is exceeded,
  1625.                                            2. the input character is EOF,
  1626.                                            3. the input character is a
  1627.                                               new-line character             */
  1628.  
  1629.     for (i=0; (i < LINE) &&
  1630.               ((ch = getwc()) != EOF) &&
  1631.               (ch != '\n'); ++i)
  1632.         buffer[i] = ch;
  1633.  
  1634.     buffer[i]=NULL;
  1635.  
  1636.     printf("The string is: %ls\n", buffer);
  1637. }
  1638.  
  1639. /****************  Output should be similar to:  ******************
  1640.  
  1641. Please enter string
  1642. hello world
  1643. The string is: hello world
  1644.  
  1645. *******************************************************************/
  1646.  
  1647.  
  1648. ΓòÉΓòÉΓòÉ 5.6. putwc -- Write a wide-character to a stream ΓòÉΓòÉΓòÉ
  1649.  
  1650.  
  1651. Syntax 
  1652.  
  1653. #include <stdio.h>
  1654. #include <wchar.h>
  1655.  
  1656. wint_t putwc(wint_t wc, FILE *stream);
  1657.  
  1658. Description 
  1659.  
  1660. This function is equivalent to the fputwc function.  See the fputwc function 
  1661. description. 
  1662.  
  1663.  
  1664. Parameters. 
  1665.  
  1666. Please refer to fputwc. 
  1667.  
  1668.  
  1669. Return Values 
  1670.  
  1671. Please refer to fputwc. 
  1672.  
  1673.  
  1674. Related Information 
  1675.  
  1676.      fputwc - Write a wide-character 
  1677.      getwc - Read a wide-character 
  1678.      fputws - Write a Wide String 
  1679.      wchar.h - Header file for wide-character prototypes. 
  1680.  
  1681.  Example 
  1682.  
  1683.  This example writes the contents of a buffer to a data stream. 
  1684.  
  1685.   #include <stdio.h>
  1686.   #include <wchar.h>
  1687.  
  1688.   int main(void)
  1689.   {
  1690.     FILE *stream = stdout;
  1691.     int i;
  1692.     wchar_t ws[200];
  1693.     char *s = "hello world";
  1694.  
  1695.     mbstowcs(ws, s, strlen(s));
  1696.  
  1697.     for (i = 0;i < wcslen(ws); i++)
  1698.         if (putwc(ws[i], stream) == WEOF)
  1699.         {
  1700.            printf("Stream I/O Failure");
  1701.            break;
  1702.         }
  1703.   }
  1704.  
  1705.   /********************  Expected output:  **************************
  1706.  
  1707.   Hello world
  1708.  
  1709.   *******************************************************************/
  1710.  
  1711.  
  1712. ΓòÉΓòÉΓòÉ 5.7. getwchar -- Read a wide-character from stdin ΓòÉΓòÉΓòÉ
  1713.  
  1714.  
  1715. Syntax 
  1716.  
  1717. #include <stdio.h>
  1718. #include <wchar.h>
  1719.  
  1720. wint_t getwchar(void);
  1721.  
  1722. Description 
  1723.  
  1724. The getwchar function is equivalent to the getwc function with stdin as the 
  1725. input stream. 
  1726.  
  1727.  
  1728. Parameters. 
  1729.  
  1730. Please refer to fgetwc. 
  1731.  
  1732.  
  1733. Return Values 
  1734.  
  1735. Please refer to fgetwc. 
  1736.  
  1737.  
  1738. Related Information 
  1739.  
  1740.      getwc - Get a wide-character. 
  1741.      fgetwc - Get a wide-character from the input stream. 
  1742.      wchar.h - Header file for wide-character prototypes. 
  1743.  
  1744.  Example 
  1745.  
  1746.  This example gets wide-characters from the keyboard and echoes them back to 
  1747.  the screen. 
  1748.  
  1749.   #include <stdio.h>
  1750.   #include <wchar.h>
  1751.  
  1752.   int main (void)
  1753.   {
  1754.     wint_t ch;
  1755.  
  1756.     printf("\nType in some letters.");
  1757.     printf("\n");
  1758.  
  1759.     for(;;)
  1760.     {
  1761.       ch = getwchar();
  1762.       putwchar(ch);
  1763.     }
  1764.  
  1765.     return(1);
  1766.   }
  1767.  
  1768.  
  1769. ΓòÉΓòÉΓòÉ 5.8. putwchar -- Write a wide-character to stdout ΓòÉΓòÉΓòÉ
  1770.  
  1771.  
  1772. Syntax 
  1773.  
  1774. #include <stdio.h>
  1775. #include <wchar.h>
  1776.  
  1777. wint_t putwchar(wint_t wc);
  1778.  
  1779. Description 
  1780.  
  1781. The putwchar function works like the putwc function, except that putwchar 
  1782. writes the specified wide character to the standard output.  Output streams, 
  1783. with the exception of stderr, are buffered by default if they refer to files, 
  1784. or line-buffered if they refer  to terminals. 
  1785.  
  1786.  
  1787. Parameters. 
  1788.  
  1789. Please refer to fputwc. 
  1790.  
  1791.  
  1792. Return Values 
  1793.  
  1794. Please refer to fputwc. 
  1795.  
  1796.  
  1797. Related Information 
  1798.  
  1799.      fputwc - Put a wide-character out to a stream. 
  1800.      putwc - Put a wide-character to std out. 
  1801.      wchar.h - Header file for wide-character prototypes. 
  1802.  
  1803.  Example 
  1804.  
  1805.  This example gets wide-characters from the keyboard and prints them out using 
  1806.  putwchar. 
  1807.  
  1808.   #include <stdio.h>
  1809.   #include <wchar.h>
  1810.  
  1811.   int main(void)
  1812.   {
  1813.     wint_t ch;
  1814.  
  1815.     printf("\nType in some letters.");
  1816.     printf("\n");
  1817.     for (;;)
  1818.     {
  1819.       ch = getwchar();
  1820.       putwchar(ch);
  1821.     }
  1822.  
  1823.     return(1);
  1824.   }
  1825.  
  1826.  
  1827. ΓòÉΓòÉΓòÉ 5.9. ungetwc -- Push wide-character back onto a stream ΓòÉΓòÉΓòÉ
  1828.  
  1829.  
  1830. Syntax 
  1831.  
  1832. #include <stdio.h>
  1833. #include <wchar.h>
  1834.  
  1835. wint_t ungetwc(wint_t wc, FILE *stream);
  1836.  
  1837. Description 
  1838.  
  1839. The ungetwc function pushes the character corresponding to the wide-character 
  1840. specified by wc back onto the given input stream.  However, only one sequential 
  1841. ungetwc is guaranteed to be pushed back onto the input stream if you call 
  1842. ungetwc consecutively without any intervening read or file-positioning 
  1843. operation.  The stream must be open for reading.  A subsequent read operation 
  1844. on the stream starts with the pushed back character.  You cannot push WEOF back 
  1845. on the stream using ungetwc. 
  1846.  
  1847. Characters placed on the stream by ungetwc will be erased if a fseek, fsetpos, 
  1848. rewind, or fflush function is called before the character is read from the 
  1849. stream. 
  1850.  
  1851.  
  1852. Parameters 
  1853.  
  1854.  wc        wide-character to be put back on the stream. 
  1855.  
  1856.  stream    Input stream into which the wide-character is to be written. 
  1857.  
  1858.  
  1859.  Return Values 
  1860.  
  1861.  wint_t 
  1862.  
  1863.            WEOF           An error occurred. 
  1864.  
  1865.            Other          The wide-character that was pushed back. 
  1866.  
  1867.  
  1868.  Related Information 
  1869.  
  1870.      getwc - Read a wide-character 
  1871.      putwc - Write a wide-character 
  1872.      wchar.h - Header file for wide-character prototypes. 
  1873.  
  1874.  Example 
  1875.  
  1876.  In this example, the while statement reads decimal digits from an input data 
  1877.  stream by using arithmetic statements to compose the numeric values of the 
  1878.  numbers as it reads them.  When a nondigit character appears before the endof 
  1879.  the file, ungetwc replaces it in the input stream so that later input 
  1880.  functions can process it. 
  1881.  
  1882.   #include <stdio.h>
  1883.   #include <ctype.h>
  1884.   #include <wchar.h>
  1885.  
  1886.   int main(void)
  1887.   {
  1888.     FILE *stream;
  1889.     int ch;
  1890.     unsigned int result = 0;
  1891.  
  1892.     while ((ch = getc(stream)) != EOF &&
  1893.            isdigit(ch))
  1894.       result = result * 10 + ch - '0';
  1895.  
  1896.     if (ch != EOF)
  1897.        ungetwc(ch, stream);
  1898.   }
  1899.  
  1900.  
  1901. ΓòÉΓòÉΓòÉ 5.10. getw -- Read a word from a stream ΓòÉΓòÉΓòÉ
  1902.  
  1903.  
  1904. Syntax 
  1905.  
  1906. #include <stdio.h>
  1907. #include <wchar.h>
  1908.  
  1909. int getw(register FILE *stream);
  1910.  
  1911. Description 
  1912.  
  1913. The getw function reads the next word from the stream.  The size of a word is 
  1914. the size of an INT and may vary from machine to machine. This function presumes 
  1915. no special alignment in the file. 
  1916.  
  1917. Due to possible differences in word length and byte ordering, files written 
  1918. using putw are machine dependent and may not be read using getw on a different 
  1919. processor. 
  1920.  
  1921.  
  1922. Parameters 
  1923.  
  1924.  stream    Input stream from which the word is to be read. 
  1925.  
  1926.  
  1927.  Return Values 
  1928.  
  1929.  int 
  1930.  
  1931.            EOF            An error occurred or end of file was reached. 
  1932.  
  1933.            Other          The word read from the input stream. 
  1934.  
  1935.  
  1936.  Related Information 
  1937.  
  1938.      putw - Write a word 
  1939.      wchar.h - Header file for wide-character prototypes. 
  1940.  
  1941.  
  1942. ΓòÉΓòÉΓòÉ 5.11. putw -- Write a word to a stream ΓòÉΓòÉΓòÉ
  1943.  
  1944.  
  1945. Syntax 
  1946.  
  1947. #include <stdio.h>
  1948. #include <wchar.h>
  1949.  
  1950.     int      putw(int w, register FILE *stream);
  1951.  
  1952. Description 
  1953.  
  1954. The putw function writes the word w to the stream at the file pointer's current 
  1955. position. A word is the size of an INT and may vary from machine to machine. 
  1956. This function presumes no special alignment in the file. 
  1957.  
  1958. Due to possible differences in word length and byte ordering, files written 
  1959. using putw are machine dependent and may not be read using getw on a different 
  1960. processor. 
  1961.  
  1962.  
  1963. Parameters 
  1964.  
  1965.  w         Word to be written. 
  1966.  
  1967.  stream    Output stream onto which the word is to be written. 
  1968.  
  1969.  
  1970.  Return Values 
  1971.  
  1972.  int 
  1973.  
  1974.            0              Word successfully written. 
  1975.  
  1976.            Non zero       An error occurred. 
  1977.  
  1978.  
  1979.  Related Information 
  1980.  
  1981.      getw - Read a word 
  1982.      wchar.h - Header file for wide-character prototypes. 
  1983.  
  1984.  
  1985. ΓòÉΓòÉΓòÉ 6. ICONV Functions ΓòÉΓòÉΓòÉ
  1986.  
  1987. The Code Set Conversion Functions are: 
  1988.  
  1989.  
  1990.     iconv_t iconv_open(const char *tocode, const char *fromcode);
  1991.  
  1992.     size_t  iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
  1993.                                     char **outbuf, size_t *outbytesleft);
  1994.  
  1995.     int     iconv_close(iconv_t *cd);
  1996.  
  1997.  
  1998. ΓòÉΓòÉΓòÉ 6.1. iconv_open -- Access a conversion descriptor ΓòÉΓòÉΓòÉ
  1999.  
  2000.  
  2001. Syntax 
  2002.  
  2003. #include <iconv.h>
  2004.  
  2005. iconv_t iconv_open(const char *tocode, const char *fromcode);
  2006.  
  2007. Description 
  2008.  
  2009. The iconv_open function is used to obtain an iconv_t descriptor that describes 
  2010. the conversion from the source code set to the target code set. For state 
  2011. dependent conversions, iconv_open starts in the initial unshifted state. 
  2012.  
  2013.  
  2014. Parameters 
  2015.  
  2016. There are two parameters to iconv_open. Both are character strings which 
  2017. represent codepages in the OS/2 system. Examples include: 
  2018.  
  2019.      437 - Major US English codepage. 
  2020.  
  2021.      850 - Codepage for most of Western Europe. 
  2022.  
  2023.      942 - Japanese double-byte codepage. 
  2024.  
  2025.  tocode       A character string specifying the target codepage. 
  2026.  
  2027.  fromcode     A character string specifying the source codepage. 
  2028.  
  2029.  
  2030.  Return Values 
  2031.  
  2032.  iconv_t 
  2033.  
  2034.            -1             An error occurred and errno is set to indicate the 
  2035.                           error. 
  2036.  
  2037.            Other          Conversion descriptior. 
  2038.  
  2039.  Related Information 
  2040.  
  2041.      iconv - Converts string of char from one character code set to another. 
  2042.      iconv_close - Deallocates all resources allocated by iconv_open. 
  2043.      iconv.h - Header file for iconv prototypes. 
  2044.  
  2045.  
  2046.  Example 
  2047.  
  2048.  See iconv for an example. 
  2049.  
  2050.  
  2051. ΓòÉΓòÉΓòÉ 6.2. iconv -- Converts string from one character code set to another ΓòÉΓòÉΓòÉ
  2052.  
  2053.  
  2054. Syntax 
  2055.  
  2056. #include <iconv.h>
  2057.  
  2058. size_t iconv(iconv_t CD, const char **InBuf, size_t *InBytesLeft,
  2059.              char **OutBuf, size_t *OutBytesLeft);
  2060.  
  2061. Description 
  2062.  
  2063. The iconv function converts the string specified by the InBuf parameter into a 
  2064. different code set and returns the results in the OutBuf parameter.  The 
  2065. required conversion method is identified by the CD parameter, which must be a 
  2066. valid conversion descriptor returned by a previous, successful call to the 
  2067. iconv_open function. 
  2068.  
  2069. On calling, the InBytesLeft parameter indicates the number of bytes in the 
  2070. InBuf buffer to be converted, and the OutBytesLeft parameter indicates the 
  2071. number of available bytes in the OutBuf buffer.  These values are updated upon 
  2072. return so they indicate the new state of their associated buffers.  For 
  2073. state-dependent encodings, calling the iconv function with the InBuf buffer set 
  2074. to null will reset the conversion descriptor in the CD parameter to its initial 
  2075. state. Subsequent calls with the InBuf buffer, specifying other than a NULL 
  2076. pointer, may cause the internal state of the function to be altered as 
  2077. necessary.  Upon successful conversion of all the characters in the InBuf 
  2078. buffer and after placing the converted characters in the OutBuf buffer, the 
  2079. iconv function returns 0, updates the InBytesLeft and OutBytesLeft parameters, 
  2080. and increments the InBuf and OutBuf pointers. 
  2081.  
  2082.  
  2083. Parameters 
  2084.  
  2085.  CD              Specifies the conversion descriptor that points to the correct 
  2086.                  code set converter. 
  2087.  
  2088.  InBuf           Points to a buffer that contains the bytes to be converted. 
  2089.  
  2090.  InBytesLeft     Points to an integer that contains the number of bytes in 
  2091.                  InBuf. 
  2092.  
  2093.  OutBuf          Points to a buffer that contains the bytes that have been 
  2094.                  converted. 
  2095.  
  2096.  OutBytesLeft    Points to an integer that contains the number of bytes in 
  2097.                  OutBuf. 
  2098.  
  2099.  
  2100.  Return Values 
  2101.  
  2102.  If the iconv function is unsuccessful, it updates the variables to reflect the 
  2103.  extent of the  conversion  before  it stopped, and sets errno to one of the 
  2104.  following values: 
  2105.  
  2106.  EILSEQ    The conversion has been stopped due to an input byte that does not 
  2107.            belong to the input codeset. 
  2108.  E2BIG     The conversion has been stopped due to lack of space in the output 
  2109.            buffer. 
  2110.  EINVAL    The conversion has been stopped due to an incomplete character or 
  2111.            shift sequence at the end of the input buffer. 
  2112.  EBADF     The argument CD is invalid. 
  2113.  
  2114.  
  2115.  Related Information 
  2116.  
  2117.      genxlt 
  2118.      iconv_open - allocates all resources needed by iconv. 
  2119.      iconv_close - Deallocates all resources allocated by iconv_open. 
  2120.      iconv.h  - Header file for iconv prototypes. 
  2121.  
  2122.  
  2123.  Example 
  2124.  
  2125.  This example converts all the characters from one code set, IBM-437, to 
  2126.  another, IBM-850.  The characters are contained in the variable "line". 
  2127.  
  2128.   #include <stdlib.h>
  2129.   #include <stdio.h>
  2130.   #include <string.h>
  2131.   #include <wchar.h>
  2132.   #include <iconv.h>
  2133.   #define  MAX_LEN  255
  2134.  
  2135.   int main(void) {
  2136.       char *from = "IBM-037",
  2137.       char *to   = "IBM-850";
  2138.  
  2139.       char buf2[256];
  2140.       long i;
  2141.  
  2142.       iconv_t cd;
  2143.  
  2144.       char *inptr;
  2145.       char *outptr;
  2146.  
  2147.       size_t inleft;
  2148.       size_t outleft;
  2149.       size_t ret;
  2150.  
  2151.       char line[MAX_LEN] = "THIS IS THE LINE TO CONVERT",
  2152.       char result[MAX_LEN];
  2153.  
  2154.       buf2[0] = NULL;
  2155.       inptr = line;
  2156.       inleft = strlen(inptr);
  2157.       outleft = sizeof(buf2);
  2158.       outptr = buf2;
  2159.  
  2160.       printf("Converting from %s to %s.\n",from,to);
  2161.       cd = iconv_open(from,to);
  2162.  
  2163.       if ((int) cd <= 0) {
  2164.         printf("ERROR OPENING ICONV TABLES");
  2165.         return 1;
  2166.         }
  2167.  
  2168.       ret = iconv(cd, &inptr, &inleft, &outptr, &outleft);
  2169.       *outptr = NULL;
  2170.  
  2171.       printf("original string: %s\n",line);
  2172.       printf("modified string: %s\n",buf2);
  2173.  
  2174.       iconv_close(cd);
  2175.       return(1);
  2176.       }
  2177.  
  2178.  
  2179. ΓòÉΓòÉΓòÉ 6.3. iconv_close -- Deallocates all resources allocated by iconv_open ΓòÉΓòÉΓòÉ
  2180.  
  2181.  
  2182. Syntax 
  2183.  
  2184. #include <iconv.h>
  2185.  
  2186. int iconv_close(iconv_t *cd);
  2187.  
  2188.  
  2189. Description 
  2190.  
  2191. The function iconv_close is used to deallocate all resources that have been 
  2192. allocated by the iconv_open function including the conversion descriptor that 
  2193. is specified by the pointer cd. 
  2194.  
  2195.  
  2196. Parameters 
  2197.  
  2198.  cd        Conversion descriptor returned by iconv_open. 
  2199.  
  2200.  
  2201.  Return Values 
  2202.  
  2203.  int 
  2204.  
  2205.            -1             An error occurred and errno has been set. 
  2206.                           EBADF          The conversion descriptor is invalid. 
  2207.            0              Successful. 
  2208.  
  2209.  
  2210.  Related Information 
  2211.  
  2212.      iconv - Converts string of char from one character code set to another. 
  2213.      iconv_open - allocates all resources needed by iconv. 
  2214.      iconv.h  - Header file for iconv prototypes. 
  2215.  
  2216.  
  2217.  Example 
  2218.  
  2219.  See iconv for an example. 
  2220.  
  2221.  
  2222. ΓòÉΓòÉΓòÉ 7. IS* Functions ΓòÉΓòÉΓòÉ
  2223.  
  2224. Character Attribute testing (Uses locale-based methods): 
  2225.  
  2226.  
  2227.    int isalnum(int c);
  2228.    int isalpha(int c);
  2229.    int iscntrl(int c);
  2230.    int isdigit(int c);
  2231.    int isgraph(int c);
  2232.    int islower(int c);
  2233.    int isprint(int c);
  2234.    int ispunct(int c);
  2235.    int isspace(int c);
  2236.    int isupper(int c);
  2237.    int isxdigit(int c);
  2238.  
  2239.    int iswalnum(wint_t wc);
  2240.    int iswalpha(wint_t wc);
  2241.    int iswcntrl(wint_t wc);
  2242.    int iswdigit(wint_t wc);
  2243.    int iswgraph(wint_t wc);
  2244.    int iswlower(wint_t wc);
  2245.    int iswprint(wint_t wc);
  2246.    int iswpunct(wint_t wc);
  2247.    int iswspace(wint_t wc);
  2248.    int iswupper(wint_t wc);
  2249.    int iswxdigit(wint_t wc);
  2250.  
  2251.    int toupper(int c);
  2252.    int tolower(int c);
  2253.  
  2254.    wint_t towupper(wint_t wc);
  2255.    wint_t towlower(wint_t wc);
  2256.  
  2257.    int iswctype(wint_t wc, wctype_t mask);
  2258.  
  2259.  
  2260. ΓòÉΓòÉΓòÉ 7.1. is* -- Character identification functions ΓòÉΓòÉΓòÉ
  2261.  
  2262.  
  2263. Syntax 
  2264.  
  2265. #include <ctype.h>
  2266.  
  2267. int isalnum(int c);
  2268. int isalpha(int c);
  2269. int iscntrl(int c);
  2270. int isdigit(int c);
  2271. int isgraph(int c);
  2272. int islower(int c);
  2273. int isprint(int c);
  2274. int ispunct(int c);
  2275.  
  2276. int isspace(int c);
  2277. int isupper(int c);
  2278. int isxdigit(int c);
  2279.  
  2280.  
  2281. Description 
  2282.  
  2283. The functions listed below all test a given integer value. 
  2284.  
  2285.  Function    Tests for 
  2286.  isalnum     upper or lowercase letters, or decimal digit 
  2287.  isalpha     alphabetic character 
  2288.  iscntrl     any control character 
  2289.  isdigit     decimal digit 
  2290.  isgraph     printable character excluding space 
  2291.  islower     lowercase 
  2292.  isprint     printable character including space 
  2293.  ispunct     any nonalphanumeric printable character, excluding space 
  2294.  isspace     whitespace character 
  2295.  isupper     uppercase 
  2296.  isxdigit    hexadecimal digit 
  2297.  
  2298.  
  2299.  Parameters 
  2300.  
  2301.  c         Integer to be tested. (EOF is a valid input value.) 
  2302.  
  2303.  
  2304.  Return Values 
  2305.  
  2306.  int 
  2307.  
  2308.            Nonzero        Successful. The integer satifies the test condition. 
  2309.  
  2310.            0              Unsuccessful. The test failed. 
  2311.  
  2312.  
  2313.  Related Information 
  2314.  
  2315.      tolower - Convert Character Case 
  2316.      toupper - Convert Character Case 
  2317.      ctype.h 
  2318.  
  2319.  
  2320.  Example 
  2321.  
  2322.  This example analyzes all characters between code 0x0 and code UPPER_LIMIT, 
  2323.  printing A for alphabetic characters, AN for alphanumerics, U for uppercase, L 
  2324.  for lowercase, D for digits, X for hexadecimal digits, S for spaces, PU for 
  2325.  punctuation, PR for printable characters, G for graphics characters, and C for 
  2326.  control characters. This example prints the code if printable. 
  2327.  
  2328.  The output of this example is a 256-line table showing the characters from 0 
  2329.  to 255 that possess the attributes tested. 
  2330.  
  2331.   #include <stdio.h>
  2332.   #include <ctype.h>
  2333.  
  2334.   #define UPPER_LIMIT   0xFF
  2335.  
  2336.   int main(void) {
  2337.       int ch;
  2338.  
  2339.       for ( ch = 0; ch <= UPPER_LIMIT; ++ch ) {
  2340.         printf("\n%3d ", ch);
  2341.         printf("%#04x ", ch);
  2342.         printf("%3s ", isalnum(ch)  ? "AN" : " ");
  2343.         printf("%2s ", isalpha(ch)  ? "A"  : " ");
  2344.         printf("%2s",  iscntrl(ch)  ? "C"  : " ");
  2345.         printf("%2s",  isdigit(ch)  ? "D"  : " ");
  2346.         printf("%2s",  isgraph(ch)  ? "G"  : " ");
  2347.         printf("%2s",  islower(ch)  ? "L"  : " ");
  2348.         printf(" %c",  isprint(ch)  ? ch   : ' ');
  2349.         printf("%3s",  ispunct(ch)  ? "PU" : " ");
  2350.         printf("%2s",  isspace(ch)  ? "S"  : " ");
  2351.         printf("%3s",  isprint(ch)  ? "PR" : " ");
  2352.         printf("%2s",  isupper(ch)  ? "U"  : " ");
  2353.         printf("%2s",  isxdigit(ch) ? "X"  : " ");
  2354.         }
  2355.  
  2356.       }
  2357.  
  2358.  
  2359. ΓòÉΓòÉΓòÉ 7.2. isw* -- wide-character identification functions ΓòÉΓòÉΓòÉ
  2360.  
  2361.  
  2362. Syntax 
  2363.  
  2364. #include <wchar.h>
  2365.  
  2366. int iswalnum(wint_t wc);
  2367. int iswalpha(wint_t wc);
  2368. int iswcntrl(wint_t wc);
  2369. int iswdigit(wint_t wc);
  2370. int iswgraph(wint_t wc);
  2371. int iswlower(wint_t wc);
  2372. int iswprint(wint_t wc);
  2373. int iswpunct(wint_t wc);
  2374.  
  2375. int iswspace(wint_t wc);
  2376. int iswupper(wint_t wc);
  2377. int iswxdigit(wint_t wc);
  2378.  
  2379.  
  2380. Description 
  2381.  
  2382. The functions listed below all test a given wide-character value. 
  2383.  
  2384.  Function    Tests for 
  2385.  iswalnum    upper or lowercase letters, or decimal digit 
  2386.  iswalpha    alphabetic character 
  2387.  iswcntrl    any control character 
  2388.  iswdigit    decimal digit 
  2389.  iswgraph    printable character excluding space 
  2390.  iswlower    lowercase 
  2391.  iswprint    printable character including space 
  2392.  iswpunct    any nonalphanumeric printable character, excluding space 
  2393.  iswspace    whitespace character 
  2394.  iswupper    uppercase 
  2395.  iswxdigit   hexadecimal digit 
  2396.  
  2397.  
  2398.  Parameters 
  2399.  
  2400.  wc        wide-character to be tested. (WEOF is a valid input value.) 
  2401.  
  2402.  
  2403.  Return Values 
  2404.  
  2405.  int 
  2406.  
  2407.            Nonzero        Successful. The wide-character satifies the test 
  2408.                           condition. 
  2409.  
  2410.            0              Unsuccessful. The test failed. 
  2411.  
  2412.  
  2413.  Related Information 
  2414.  
  2415.      is* functions 
  2416.      wchar.h 
  2417.  
  2418.  
  2419.  Example 
  2420.  
  2421.  This example analyzes all characters between code 0x0 and code UPPER_LIMIT, 
  2422.  printing A for alphabetic characters, AN for alphanumerics, U for uppercase, L 
  2423.  for lowercase, D for digits, X for hexadecimal digits, S for spaces, PU for 
  2424.  punctuation, PR for printable characters, G for graphics characters, and C for 
  2425.  control characters. This example prints the code if printable. 
  2426.  
  2427.  The output of this example is a 256-line table showing the characters from 0 
  2428.  to 255 that possess the attributes tested. 
  2429.  
  2430.   #include <stdio.h>
  2431.   #include <wchar.h>
  2432.  
  2433.   #define UPPER_LIMIT   0xFF
  2434.  
  2435.   int main(void) {
  2436.       wint_t ch;
  2437.  
  2438.       for ( ch = 0; ch <= UPPER_LIMIT; ++ch ) {
  2439.         printf("\n%3d ", ch);
  2440.         printf("%#04x ", ch);
  2441.         printf("%3s ", iswalnum(ch)  ? "AN" : " ");
  2442.         printf("%2s ", iswalpha(ch)  ? "A"  : " ");
  2443.         printf("%2s",  iswcntrl(ch)  ? "C"  : " ");
  2444.         printf("%2s",  iswdigit(ch)  ? "D"  : " ");
  2445.         printf("%2s",  iswgraph(ch)  ? "G"  : " ");
  2446.         printf("%2s",  iswlower(ch)  ? "L"  : " ");
  2447.         printf(" %c",  iswprint(ch)  ? ch   : ' ');
  2448.         printf("%3s",  iswpunct(ch)  ? "PU" : " ");
  2449.         printf("%2s",  iswspace(ch)  ? "S"  : " ");
  2450.         printf("%3s",  iswprint(ch)  ? "PR" : " ");
  2451.         printf("%2s",  iswupper(ch)  ? "U"  : " ");
  2452.         printf("%2s",  iswxdigit(ch) ? "X"  : " ");
  2453.         }
  2454.  
  2455.       }
  2456.  
  2457.  
  2458. ΓòÉΓòÉΓòÉ 7.3. iswctype -- Class test for characters ΓòÉΓòÉΓòÉ
  2459.  
  2460.  
  2461. Syntax 
  2462.  
  2463. #include <wchar.h>
  2464.  
  2465. int iswctype(wint_t wc, wctype_t mask);
  2466.  
  2467.  
  2468. Description 
  2469.  
  2470. The iswctype function uses the character class to determine if a wide-character 
  2471. is in the specified class. 
  2472.  
  2473.  
  2474. Parameters 
  2475.  
  2476.  wc        wide-character to be tested. 
  2477.  
  2478.  mask      Character class string. The character classes are defined in each 
  2479.            locale by the following key strings: 
  2480.  
  2481.            "alnum"         -  for the alpha numeric class. 
  2482.            "alpha"         -  for the alphabetic only class. 
  2483.            "cntrl"         -  for the control class. 
  2484.            "digit"         -  for the digit class. 
  2485.            "graph"         -  for the graphics character class. 
  2486.            "lower"         -  for the lower case character class. 
  2487.            "print"         -  for the printable character class. 
  2488.            "punct"         -  for the punctuation class. 
  2489.            "space"         -  for the space character class. 
  2490.            "upper"         -  for the upper case character class. 
  2491.            "xdigit"        -  for the digit or alpha character class. 
  2492.            "blank"         -  for the hexadecimal alpha numeric class. 
  2493.  
  2494.  Return Values 
  2495.  
  2496.  int 
  2497.  
  2498.            Nonzero        Successful. The wide-character satifies the test 
  2499.                           condition. 
  2500.  
  2501.            0              Unsuccessful. The test failed. 
  2502.  
  2503.  
  2504.  Related Information 
  2505.  
  2506.      wctype 
  2507.      wchar.h 
  2508.      isw* functions 
  2509.  
  2510.  
  2511.  Example 
  2512.  
  2513.  This example analyzes all characters between code 0x0 and code UPPER_LIMIT, 
  2514.  printing A for alphabetic characters, AN for alphanumerics, U for uppercase, L 
  2515.  for lowercase, D for digits, X for hexadecimal digits, S for spaces, PU for 
  2516.  punctuation, PR for printable characters, G for graphics characters, and C for 
  2517.  control characters. This example prints the code if printable. 
  2518.  
  2519.  The output of this example is a 256-line table showing the characters from 0 
  2520.  to 255 that possess the attributes tested. 
  2521.  
  2522.   #include <stdio.h>
  2523.   #include <wchar.h>
  2524.  
  2525.   #define UPPER_LIMIT   0xFF
  2526.  
  2527.   int main(void) {
  2528.       wint_t ch;
  2529.  
  2530.       for ( ch = 0; ch <= UPPER_LIMIT; ++ch ) {
  2531.         printf("\n%3d ", ch);
  2532.         printf("%#04x ", ch);
  2533.         printf("%3s", iswctype(ch,wctype("alnum"))  ? "AN" : " ");
  2534.         printf("%2s", iswctype(ch,wctype("alpha"))  ? "A"  : " ");
  2535.         printf("%2s", iswctype(ch,wctype("cntrl"))  ? "C"  : " ");
  2536.         printf("%2s", iswctype(ch,wctype("digit"))  ? "D"  : " ");
  2537.         printf("%2s", iswctype(ch,wctype("graph"))  ? "G"  : " ");
  2538.         printf("%2s", iswctype(ch,wctype("lower"))  ? "L"  : " ");
  2539.         printf(" %c", iswctype(ch,wctype("blank"))  ? "B"  : " ");
  2540.         printf("%3s", iswctype(ch,wctype("punct"))  ? "PU" : " ");
  2541.         printf("%2s", iswctype(ch,wctype("space"))  ? "S"  : " ");
  2542.         printf("%3s", iswctype(ch,wctype("print"))  ? "PR" : " ");
  2543.         printf("%2s", iswctype(ch,wctype("upper"))  ? "U"  : " ");
  2544.         printf("%2s", iswctype(ch,wctype("xdigit")) ? "X"  : " ");
  2545.         }
  2546.  
  2547.       }
  2548.  
  2549.  
  2550. ΓòÉΓòÉΓòÉ 7.4. tolower / toupper -- Convert character case ΓòÉΓòÉΓòÉ
  2551.  
  2552.  
  2553. Syntax 
  2554.  
  2555. #include <ctype.h>
  2556.  
  2557. int tolower(int c);   /* Convert c to lowercase if appropriate */
  2558. int toupper(int c);   /* Convert c to uppercase if appropriate */
  2559.  
  2560.  
  2561. Description 
  2562.  
  2563. The tolower function returns a lowercase letter if the value in c represents an 
  2564. uppercase letter and there exists a corresponding lowercase letter (as defined 
  2565. by character type information in the program locale category LC_CTYPE). 
  2566. Otherwise, c is returned.  The input parameter is unchanged. 
  2567.  
  2568. The toupper function returns an uppercase letter if the value in c represents a 
  2569. lowercase letter and there exists a corresponding uppercase letter (as defined 
  2570. by character type information in the program locale category LC_CTYPE). 
  2571. Otherwise, c is returned. The input parameter is unchanged. 
  2572.  
  2573.  
  2574. Parameters 
  2575.  
  2576.  c         Character to be converted. 
  2577.  
  2578.  Return Values 
  2579.  
  2580.  int 
  2581.  
  2582.            Nonzero        Converted letter if successful.  Nonconverted letter 
  2583.                           if unsuccessful. 
  2584.  
  2585.  
  2586.  Related Information 
  2587.  
  2588.      isalnum to isxdigit - Test Integer Value 
  2589.      isascii - Test Integer Values 
  2590.      toascii - Convert Character 
  2591.      tolower - Convert Character 
  2592.      toupper - Convert Character 
  2593.      wchar.h 
  2594.  
  2595.  
  2596.  Example 
  2597.  
  2598.  This example uses the toupper and tolower functions to modify characters 
  2599.  between code 0 and code 7f. 
  2600.  
  2601.   #include <stdio.h>
  2602.   #include <ctype.h>
  2603.  
  2604.   int main(void) {
  2605.       int ch;
  2606.  
  2607.       for (ch = 0; ch <= 0x7f; ch++) {
  2608.         printf("\ntoupper=%#04x  -  ", toupper(ch));
  2609.         printf("tolower=%#04x", tolower(ch));
  2610.         }
  2611.  
  2612.       }
  2613.  
  2614.  
  2615. ΓòÉΓòÉΓòÉ 7.5. towlower / towupper -- Convert wide-character case ΓòÉΓòÉΓòÉ
  2616.  
  2617.  
  2618. Syntax 
  2619.  
  2620. #include <ctype.h>
  2621.  
  2622.    wint_t towupper(wint_t wc);
  2623.    wint_t towlower(wint_t wc);
  2624.  
  2625.  
  2626. Description 
  2627.  
  2628. The towlower function returns a lowercase wide-character if the value in wc 
  2629. represents an uppercase wide-character and there exists a corresponding 
  2630. lowercase wide-character (as defined by character type information in the 
  2631. program locale category LC_CTYPE). Otherwise, wc is returned.  The input 
  2632. parameter is unchanged. 
  2633.  
  2634. The towupper function returns an uppercase wide-character if the value in wc 
  2635. represents a lowercase wide-character and there exists a corresponding 
  2636. uppercase wide-character (as defined by character type information in the 
  2637. program locale category LC_CTYPE). Otherwise, wc is returned. The input 
  2638. parameter is unchanged. 
  2639.  
  2640.  
  2641. Parameters 
  2642.  
  2643.  wc        wide-character to be converted. 
  2644.  
  2645.  Return Values 
  2646.  
  2647.  wint_t 
  2648.  
  2649.            Nonzero        Converted wide-character if successful.  Nonconverted 
  2650.                           wide-character if unsuccessful. 
  2651.  
  2652.  
  2653.  Related Information 
  2654.  
  2655.      iswalnum to iswxdigit - Test Integer Value 
  2656.      iswascii - Test Integer Values 
  2657.      towascii - Convert Character 
  2658.      tolower - Convert Character 
  2659.      toupper - Convert Character 
  2660.      wchar.h 
  2661.  
  2662.  
  2663. ΓòÉΓòÉΓòÉ 8. Locale/MB* Functions ΓòÉΓòÉΓòÉ
  2664.  
  2665. The basic conversion methods for multibyte and wchar_t: 
  2666.  
  2667.  
  2668.     int    mblen(const char *s, size_t n);
  2669.     size_t mbstowcs(wchar_t *ws, const char *s, size_t n);
  2670.     int    mbtowc(wchar_t *wc, const char *s, size_t n);
  2671.     double wcstod(const wchar_t *nptr, wchar_t **endptr);
  2672.     long   wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
  2673.     size_t wcstombs(char *s, const wchar_t *ws, size_t n);
  2674.     unsigned long wcstoul (const wchar_t *nptr, wchar_t **endptr, int base);
  2675.     int    wctomb(char *s, wchar_t wchar);
  2676.  
  2677.  
  2678. ΓòÉΓòÉΓòÉ 8.1. mblen -- Length in bytes of multi-byte character ΓòÉΓòÉΓòÉ
  2679.  
  2680.  
  2681. Syntax 
  2682.  
  2683. #include <stdlib.h>
  2684. #include <wchar.h>
  2685.  
  2686. int   mblen(const char *string, size_t n);
  2687.  
  2688.  
  2689. Description 
  2690.  
  2691. The mblen function determines the length in bytes of the multi-byte character 
  2692. pointed to by string. A maximum of n bytes is examined. 
  2693.  
  2694.  
  2695. Parameters 
  2696.  
  2697.  string    Points to multibyte character. 
  2698.  n         Maximum number of bytes to examine. 
  2699.  
  2700.  
  2701.  Return Values 
  2702.  
  2703.  If string is NULL, the mblen function returns: 
  2704.  
  2705.      Nonzero when encodings have state dependency 
  2706.  
  2707.      Zero otherwise. 
  2708.  
  2709.  If string is not NULL, the mblen function returns: 
  2710.  
  2711.      Zero if string points to the null character 
  2712.  
  2713.      The number of bytes comprising the multi-byte character 
  2714.  
  2715.      -1 if string does not point to a valid multi-byte character. 
  2716.  
  2717.  
  2718.  Related Information 
  2719.  
  2720.      mbtowc  - Convert multi-byte character to wchar_t 
  2721.      mbstowcs - Convert multi-byte characters to wchar_t characters 
  2722.      strlen  - Determine string length 
  2723.      wcslen  - Calculate length of wchar_t string 
  2724.      wctomb  - Convert wchar_t character to multi-byte character 
  2725.      wchar.h 
  2726.  
  2727.  
  2728.  Example 
  2729.  
  2730.  This example uses mblen to obtain the length of a multi-byte string. 
  2731.  
  2732.   #include <stdio.h>
  2733.   #include <wchar.h>
  2734.  
  2735.   int main(void) {
  2736.       int   length;
  2737.       char *string = "String of multi byte characters";
  2738.  
  2739.       length = mblen(string, MB_CUR_MAX);
  2740.  
  2741.       printf("mblen rc %i  multi-byte character: %c",length,*string);
  2742.       }
  2743.  
  2744.  
  2745. ΓòÉΓòÉΓòÉ 8.2. mbstowcs -- Converts character string to a wide-character string ΓòÉΓòÉΓòÉ
  2746.  
  2747.  
  2748. Syntax 
  2749.  
  2750. #include <stdlib.h>
  2751. #include <wchar.h>
  2752.  
  2753. size_t mbstowcs(wchar_t *pwc, const char *string, size_t n);
  2754.  
  2755.  
  2756. Description 
  2757.  
  2758. The mbstowcs function converts a string of multi-byte characters into a string 
  2759. of wide-characters. No more than n characters will be converted. No characters 
  2760. that follow a null byte will be examined or converted. 
  2761.  
  2762.  
  2763. Parameters 
  2764.  
  2765.  pwc       Pointer to target string of wide-characters. 
  2766.  
  2767.  string    Source string of multi-byte characters to be converted. 
  2768.  
  2769.  n         Maximum number of multi-byte characters that will be converted. 
  2770.  
  2771.  
  2772.  Return Values 
  2773.  
  2774.  If pwc is NULL, the mbstowcs function returns: 
  2775.  
  2776.      number of elements required for the wide-character. 
  2777.  
  2778.  If pwc is not NULL, the mbstowcx function returns: 
  2779.  
  2780.      the number of wide-characters generated not including any null 
  2781.       terminators. 
  2782.  
  2783.      a -1 if it encounters an invalid multibyte character. 
  2784.  
  2785.  The returned wide-character string will be null terminated unless if the 
  2786.  returned value is equal to n. 
  2787.  
  2788.  
  2789.  Related Information 
  2790.  
  2791.      mblen   - Multi-byte string length 
  2792.      mbtowc  - Convert multi-byte character to wchar_t 
  2793.      wcslen  - Calculate length of wchar_t string 
  2794.      wcstombs - Convert wchar_t string to multi-byte character string 
  2795.      wchar.h 
  2796.  
  2797.  
  2798.  Example 
  2799.  
  2800.  This example uses mbstowcs to convert a multi-byte character string into a 
  2801.  wide-character string. 
  2802.  
  2803.   #include <stdio.h>
  2804.   #include <wchar.h>
  2805.  
  2806.   int main(void) {
  2807.       int     rc;
  2808.       char   *string = "String of multi byte characters";
  2809.       wchar_t arr[20];
  2810.  
  2811.       rc = mbstowcs(arr,string,19);
  2812.  
  2813.       printf("\n\nmbstowcs rc %i   wide-character string: %S\n",rc,&arr[0]);
  2814.       }
  2815.  
  2816.  
  2817. ΓòÉΓòÉΓòÉ 8.3. mbtowc -- Converts character to wide-character ΓòÉΓòÉΓòÉ
  2818.  
  2819.  
  2820. Syntax 
  2821.  
  2822. #include <stdlib.h>
  2823. #include <wchar.h>
  2824.  
  2825. int mbtowc(wchar_t *pwc, const char *string, size_t n);
  2826.  
  2827.  
  2828. Description 
  2829.  
  2830. The mbtowc function first determines the length of the multi-byte character 
  2831. pointed to by string.  It then stores the wide-character code for the 
  2832. multi-byte character in the wchar_t object pointed to by pwc.  A maximum of n 
  2833. bytes is examined. 
  2834.  
  2835.  
  2836. Parameters 
  2837.  
  2838.  pwc       Pointer to target wide-character. 
  2839.  
  2840.  string    Pointer to multi-byte character to be converted. 
  2841.  
  2842.  n         Maximum number of bytes that will be examined. 
  2843.  
  2844.  
  2845.  Return Values 
  2846.  
  2847.  If string is NULL, the mbtowc function returns: 
  2848.  
  2849.      Nonzero when encodings have state dependency 
  2850.  
  2851.      0 otherwise. 
  2852.  
  2853.  If string is not NULL, the mbtowc function returns: 
  2854.  
  2855.      0 if string points to the null character 
  2856.  
  2857.      The number of bytes comprising the converted multi-byte character 
  2858.  
  2859.      -1 if string does not point to a valid multi-byte character or if a valid 
  2860.       multi-byte character is not found in n or fewer bytes. 
  2861.  
  2862.  
  2863.  Related Information 
  2864.  
  2865.      mblen   - Multi-byte string length 
  2866.      mbstowcs - Convert multi-byte characters to wchar_t characters 
  2867.      wcslen  - Calculate length of wchar_t string 
  2868.      wctomb  - Convert wchar_t character to multi-byte character 
  2869.      wchar.h 
  2870.  
  2871.  
  2872.  Example 
  2873.  
  2874.  This example uses mbtowc to convert a multi-byte character into a single 
  2875.  wide-character. 
  2876.  
  2877.   #include <stdio.h>
  2878.   #include <stdlib.h>
  2879.   #include <wchar_t.h>
  2880.  
  2881.   int main(void) {
  2882.       int     rc;
  2883.       char   *string = "ABC";
  2884.       wchar_t arr;
  2885.  
  2886.       rc = mbtowc(&arr,string,MB_CUR_MAX);
  2887.  
  2888.       printf("\nmbtowc rc : %i   wide-character : %C\n",rc,arr);
  2889.       }
  2890.  
  2891.  
  2892. ΓòÉΓòÉΓòÉ 8.4. wcstod -- Converts wide char strings to double precision number ΓòÉΓòÉΓòÉ
  2893.  
  2894.  
  2895. Syntax 
  2896.  
  2897. #include <wchar.h>
  2898.  
  2899. double wcstod (const wchar_t *nptr, wchar_t **endptr);
  2900.  
  2901. Description 
  2902.  
  2903. This function converts the initial portion of the wide character string pointed 
  2904. to by the nptr parameter to a signed long integer representation.  The input 
  2905. wide-character string is first broken down into three parts: 
  2906.  
  2907.  1  An initial, possibly empty, sequence of white-space wide character codes 
  2908.     (as specified by the iswspace function). 
  2909.  
  2910.  2  A subject sequence interpreted as a floating-point constant 
  2911.  
  2912.  3  A final wide-character string of one or more unrecognized wide character 
  2913.     codes, including the terminating wide-character null of the input 
  2914.     wide-character string. 
  2915.  
  2916.  If possible, the subject is then converted to a floating point number and the 
  2917.  result is returned. 
  2918.  
  2919.  The wide-character string is parsed to skip the initial space characters (as 
  2920.  determined by the iswspace function).  Any non space character signifies the 
  2921.  start of a subject string that may form a floating constant except that the 
  2922.  radix is used in place of a period and if neither an exponent part nor a radix 
  2923.  appears, a radix is assumed to follow the last digit in the wide-character 
  2924.  string. The subject string is defined to be the longest initial substring that 
  2925.  is of the expected form.  Any character not satisfying this form begins the 
  2926.  final portion of the wide character string pointed to by the endptr parameter 
  2927.  on return from the call to the this function. 
  2928.  
  2929.  The radix is defned in the program's locale. 
  2930.  
  2931.  The subject string contains no wide-character codes if the input wide 
  2932.  character string is empty or consists entirely of white-space wide-character 
  2933.  codes or if the first non-white-space wide-character code is not a sign, a 
  2934.  digit, or a radix. 
  2935.  
  2936.  No conversion is performed if the subject string is empty or does not have the 
  2937.  expected form. 
  2938.  
  2939.  
  2940.  Parameters 
  2941.  
  2942.  nptr      Contains a pointer to the wide-character string to be converted. The 
  2943.            expected form of the subject string is an optional sign, followed by 
  2944.            a non-empty sequence of digits optionally containing a radix, then 
  2945.            an optional exponent part.  The exponent part consits of e(E) 
  2946.            followed by an optional sign, followed by 1 or more decimal digits. 
  2947.  
  2948.  endptr    If not NULL, contains a pointer to the position in the nptr string 
  2949.            where a wide-character is found that is not a valid character for 
  2950.            the purpose of this conversion.  If no conversion takes place and 
  2951.            this pointer is not NULL, contains a pointer to the value of nptr. 
  2952.  
  2953.  
  2954.  Return Values 
  2955.  
  2956.  double         The converted value of double if expected form is found. 
  2957.  
  2958.  0              No conversion could be performed and global variable errno is 
  2959.                 set to EINVAL or the correct value would cause an underflow so 
  2960.                 global variable errno is set to ERANGE. 
  2961.  
  2962.  HUGE_VAL       Converted value is outside the range of representable values. 
  2963.                 Global variable errno is set to ERANGE. 
  2964.  
  2965.  Since 0 is returned in the event of an error and is also valid if the function 
  2966.  is successful, applications should set the errno global variable to 0 before 
  2967.  calling the function, and then check the errno global variable after return. 
  2968.  Then, if the errno global variable has changed, an error occurred. 
  2969.  
  2970.  
  2971.  Related Information 
  2972.  
  2973.      iswspace - Checks for a valid wide-character space. 
  2974.      wsctol  - Converts wide-character strings to long integer. 
  2975.      wsctoul  - Converts wide-character strings to unsigned long integer. 
  2976.      wchar.h  - Header file for wide-character function prototypes. 
  2977.  
  2978.  
  2979.  Example 
  2980.  
  2981.  This example converts a wide-character string to a double. 
  2982.  
  2983.   #include <stdio.h>
  2984.   #include <wchar.h>
  2985.  
  2986.   #define SIZE  40
  2987.  
  2988.   main()
  2989.   {
  2990.  
  2991.     wchar_t WCString[SIZE],
  2992.             *endptr;
  2993.  
  2994.     double retval;
  2995.  
  2996.     /** Set errno to 0 so a failure for wcstod can be **detected */
  2997.     errno=0;
  2998.  
  2999.     mbstowcs(WCString,"10e2",SIZE);
  3000.  
  3001.     /*
  3002.      ** Let WCString point to a wide-character null terminated
  3003.      ** string containing a double
  3004.     */
  3005.  
  3006.     retval = wcstod ( WCString, &endptr );
  3007.     /* Check errno, if it is non-zero, wcstod failed */
  3008.     if (errno != 0)
  3009.     {
  3010.       /*Error handling*/
  3011.       printf("An error occurred during conversion\n");
  3012.     }
  3013.     else if (retval == HUGE_VAL)
  3014.     {
  3015.       /* No conversion could be performed */
  3016.       /* Handle this case accordingly. */
  3017.       printf("No conversion could be performed\n");
  3018.     }
  3019.     /* retval contains double */
  3020.     printf("This should be a double %ld\n",retval);
  3021.   }
  3022.  
  3023.  
  3024. ΓòÉΓòÉΓòÉ 8.5. wcstol -- Converts a wide char string to long int representation ΓòÉΓòÉΓòÉ
  3025.  
  3026.  
  3027. Syntax 
  3028.  
  3029. #include <wchar.h>
  3030.  
  3031. long int wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
  3032.  
  3033.  
  3034. Description 
  3035.  
  3036. This function converts the initial portion of the wide character string pointed 
  3037. to by the nptr parameter to a signed long integer representation.  The input 
  3038. wide-character string is first broken down into three parts: 
  3039.  
  3040.  1  An initial, possibly empty, sequence of white-space wide character codes 
  3041.     (as specified by the iswspace function). 
  3042.  
  3043.  2  A subject sequence interpreted as an integer and represented in a radix 
  3044.     determined by the base parameter. 
  3045.  
  3046.  3  A final wide-character string of one or more unrecognized wide character 
  3047.     codes, including the terminating wide-character null of the input 
  3048.     wide-character string. 
  3049.  
  3050.  If possible, the subject is then converted to an integer and the result is 
  3051.  returned. 
  3052.  
  3053.  The wide-character string is parsed to skip the initial space characters (as 
  3054.  determined by the iswspace function).  Any non space character signifies the 
  3055.  start of a subject string that may form an integer in the radix specified by 
  3056.  the base parameter. The subject string is defined to be the longest initial 
  3057.  substring that is a long integer of the expected form.  Any character not 
  3058.  satisfying this form begins the final portion of the wide character string 
  3059.  pointed to by the endptr parameter on return from the call to the wcstol 
  3060.  function. 
  3061.  
  3062.  The subject string contains no wide-character codes if the input wide 
  3063.  character string is empty or consists entirely of white-space wide-character 
  3064.  codes or if the first non-white-space wide-character code is not a sign or 
  3065.  permissible letter or digit. 
  3066.  
  3067.  No conversion is performed if the subject string is empty or does not have the 
  3068.  expected form. 
  3069.  
  3070.  
  3071.  Parameters 
  3072.  
  3073.  nptr      Contains a pointer to the wide-character string to be converted to a 
  3074.            long integer. 
  3075.  
  3076.  endptr    If not NULL, contains a pointer to the position in the nptr string 
  3077.            where a wide-character is found that is not a valid character for 
  3078.            the purpose of this conversion.  If no conversion takes place and 
  3079.            this pointer is not NULL, contains a pointer to the value of nptr. 
  3080.  
  3081.  base      Specifies the radix in which the characters are interpreted.  The 
  3082.            value also determines the expected form of the subject string. 
  3083.  
  3084.                 Value      Expected Form 
  3085.  
  3086.            0               The subject string is that of a decimal, octal, or 
  3087.                            hexadecimal constant, optionally preceded by a plus 
  3088.                            or minus sign. A decimal constant begins with a 
  3089.                            non-zero digit and consists of a sequence of decimal 
  3090.                            digits.  An octal constant begins with a 0 
  3091.                            optionally followed by a sequence of digits 0 
  3092.                            through 7.  A hexadecimal constant starts with 0x or 
  3093.                            0X followed by a sequence of the decimal digits and 
  3094.                            letters (a(A) to f(F)). 
  3095.  
  3096.            2 through 36    The subject string is a sequence of letters and 
  3097.                            digits representing an integer in the radix 
  3098.                            specified by the base parameter, optionally preceded 
  3099.                            by a plus or minus sign, but not including an 
  3100.                            integer suffix.  The letters a(A) through z(Z) are 
  3101.                            ascribed the values 10 to 35. Only letters whose 
  3102.                            values are less than that of the specified base are 
  3103.                            permitted.  If the value of base is 16, the 
  3104.                            characters 0x or 0X may optionally precede the 
  3105.                            sequence of letters or digits, following the sign if 
  3106.                            present. 
  3107.  
  3108.  
  3109.  Return Values 
  3110.  
  3111.  long integer   The converted value of long interger if expected form is found. 
  3112.  
  3113.  0              No conversion could be performed.  Global variable errno is set 
  3114.                 to EINVAL.  The value of base may not be supported. 
  3115.  
  3116.  LONG_MAX       Converted value is outside the range of representable values. 
  3117.                 Global variable errno is set to ERANGE. 
  3118.  
  3119.  LONG_MIN       Converted value is outside the range of representable values. 
  3120.  
  3121.  Since 0, LONG_MIN, and LONG_MAX are returned in the event of an error and are 
  3122.  also valid returns if the wcstol function is successful, applications should 
  3123.  set the errno global variable to 0 before calling the wcstol function, and 
  3124.  then check the errno global variable after return.  Then, if the errno global 
  3125.  variable has changed, an error occurred. 
  3126.  
  3127.  
  3128.  Related Information 
  3129.  
  3130.      iswspace - Checks for a valid wide-character space. 
  3131.      wcstod  - Converts a wide-character string to a double-precision number. 
  3132.      wsctoul  - Converts wide-character strings to unsigned long integer. 
  3133.      wchar.h  - Header file for wide-character function prototypes. 
  3134.  
  3135.  
  3136.  Example 
  3137.  
  3138.  The following converts a wide-character string to a signed long integer. 
  3139.  
  3140.   #include <stdio.h>
  3141.   #include <wchar.h>
  3142.  
  3143.   #define SIZE  40
  3144.  
  3145.   main()
  3146.   {
  3147.  
  3148.     wchar_t WCString[SIZE],
  3149.             *endptr;
  3150.  
  3151.     long int retval;
  3152.  
  3153.     /** Set errno to 0 so a failure for wcstol can be **detected */
  3154.     errno=0;
  3155.  
  3156.     mbstowcs(WCString,"-100000",SIZE);
  3157.  
  3158.     /*
  3159.      ** Let WCString point to a wide-character null terminated
  3160.      ** string containing a signed long integer value
  3161.      **
  3162.     */
  3163.  
  3164.     retval = wcstol ( WCString, &endptr, 10 );
  3165.     /* Check errno, if it is non-zero, wcstol failed */
  3166.     if (errno != 0)
  3167.     {
  3168.       /*Error handling*/
  3169.       printf("An error occurred during conversion\n");
  3170.     }
  3171.     else if (retval == 0)
  3172.     {
  3173.       /* No conversion could be performed */
  3174.       /* Handle this case accordingly. */
  3175.       printf("No conversion could be performed\n");
  3176.     }
  3177.     /* retval contains long integer */
  3178.     printf("This should be a long integer %ld\n",retval);
  3179.   }
  3180.  
  3181.  
  3182. ΓòÉΓòÉΓòÉ 8.6. wcstombs -- Converts a wide-character string to a character string ΓòÉΓòÉΓòÉ
  3183.  
  3184.  
  3185. Syntax 
  3186.  
  3187. #include <wchar.h>
  3188.  
  3189. size_t wcstombs(char *dest, const wchar_t *ws, size_t count);
  3190.  
  3191. Description. 
  3192.  
  3193. The wcstombs function converts the wide-character string pointed to by ws into 
  3194. a sequence of characters and stores them in the array pointed to by dest. The 
  3195. converted string begins in the initial shift state. The conversion stops after 
  3196. count bytes in dest are filled up or a null byte is stored.  The target string 
  3197. will be null terminated unless the number of bytes converted equals count. 
  3198.  
  3199.  
  3200. Parameters 
  3201.  
  3202.  dest      Pointer to target character string. 
  3203.  
  3204.  ws        Pointer to wide-character string to be converted. 
  3205.  
  3206.  count     Maximum number of bytes that will be converted. 
  3207.  
  3208.  
  3209.  Return Values 
  3210.  
  3211.  If dest is NULL, the mbtowc function returns: 
  3212.  
  3213.      The number of bytes required for the character array. 
  3214.  
  3215.  If dest is not NULL, the mbtowc function returns: 
  3216.  
  3217.      -1 if the wide-character encountered cannot be converted. 
  3218.  
  3219.      The number of bytes stored in the array pointed to by dest excluding any 
  3220.       null terminator if the wide-character is successfully converted. 
  3221.  
  3222.  
  3223.  Related Information 
  3224.  
  3225.      mbstowcs - Convert multi-byte Characters to wchar_t Characters 
  3226.      wcslen  - Calculate Length of wchar_t String 
  3227.      wctomb  - Convert wchar_t Character to multi-byte Character 
  3228.      wchar.h 
  3229.  
  3230.  
  3231.  Example 
  3232.  
  3233.  In this example, a wchar_t string is converted to a char string twice. The 
  3234.  first call converts the entire string, while the second call only converts 
  3235.  three characters. The results are printed each time. 
  3236.  
  3237.   #include <stdio.h>
  3238.   #include <stdlib.h>
  3239.   #include <string.h>
  3240.   #include <wchar.h>
  3241.  
  3242.   int main(void) {
  3243.       char dest[20];
  3244.       wchar_t dptr[20];
  3245.       size_t count = 20;
  3246.       size_t length;
  3247.  
  3248.       mbstowcs(dptr,"string",7);
  3249.       length = wcstombs( dest, dptr, count );
  3250.       printf( "%d bytes were converted.\n", length );
  3251.       printf( "The converted string is \"%s\"\n\n", dest );
  3252.  
  3253.       memset( dest, '\0', sizeof(dest));      /* Initialize the buffer */
  3254.  
  3255.       /* Now convert only 3 bytes */
  3256.       length = wcstombs( dest, dptr, 3 );
  3257.  
  3258.       printf( "%d bytes were converted.\n", length );
  3259.       printf( "The converted string is \"%s\"\n", dest );
  3260.       }
  3261.   /****************  Output should be similar to:  ******************
  3262.  
  3263.   12 bytes were converted.
  3264.   The converted string is "string"
  3265.  
  3266.   3 bytes were converted.
  3267.   The converted string is "str"
  3268.  
  3269.   *******************************************************************/
  3270.  
  3271.  
  3272. ΓòÉΓòÉΓòÉ 8.7. wcstoul -- Converts wide char strings to unsigned long int ΓòÉΓòÉΓòÉ
  3273.  
  3274.  
  3275. Syntax 
  3276.  
  3277. #include <wchar.h>
  3278.  
  3279. unsigned long wcstoul(const wchar_t *nptr,
  3280.                   wchar_t **endptr, int base);
  3281.  
  3282. Description 
  3283.  
  3284. This function converts the initial portion of the wide character string pointed 
  3285. to by the nptr parameter to an unsigned long integer representation.  The input 
  3286. wide-character string is first broken down into three parts: 
  3287.  
  3288.  1  An initial, possibly empty, sequence of white-space wide character codes 
  3289.     (as specified by the iswspace function). 
  3290.  
  3291.  2  A subject sequence interpreted as an integer and represented in a radix 
  3292.     determined by the base parameter. 
  3293.  
  3294.  3  A final wide-character string of one or more unrecognized wide character 
  3295.     codes, including the terminating wide-character null of the input 
  3296.     wide-character string. 
  3297.  
  3298.  If possible, the subject is then converted to an unsigned long integer and the 
  3299.  result is returned. 
  3300.  
  3301.  The wide-character string is parsed to skip the initial space characters (as 
  3302.  determined by the iswspace function).  Any non space character signifies the 
  3303.  start of a subject string that may form an unsigned integer in the radix 
  3304.  specified by the base parameter. The subject string is defined to be the 
  3305.  longest initial substring that is a long integer of the expected form.  Any 
  3306.  character not satisfying this form begins the final portion of the wide 
  3307.  character string pointed to by the endptr parameter on return from the call to 
  3308.  the wcstol function. 
  3309.  
  3310.  The subject string contains no wide-character codes if the input wide 
  3311.  character string is empty or consists entirely of white-space wide-character 
  3312.  codes or if the first non-white-space wide-character code is not a sign or 
  3313.  permissible letter or digit. 
  3314.  
  3315.  No conversion is performed if the subject string is empty or does not have the 
  3316.  expected form. 
  3317.  
  3318.  
  3319.  Parameters 
  3320.  
  3321.  nptr      Contains a pointer to the wide-character string to be converted to 
  3322.            an unsigned long integer. 
  3323.  
  3324.  endptr    If not NULL, contains a pointer to the position in the nptr string 
  3325.            where a wide-character is found that is not a valid character for 
  3326.            the purpose of this conversion.  If no conversion takes place and 
  3327.            this pointer is not NULL, contains a pointer to the value of nptr. 
  3328.  
  3329.  base      Specifies the radix in which the characters are interpreted.  The 
  3330.            value also determines the expected form of the subject string. 
  3331.  
  3332.                 Value      Expected Form 
  3333.  
  3334.            0               The subject string is that of a decimal, octal, or 
  3335.                            hexadecimal constant, optionally preceded by a plus 
  3336.                            or minus sign. A decimal constant begins with a 
  3337.                            non-zero digit and consists of a sequence of decimal 
  3338.                            digits.  An octal constant begins with a 0 
  3339.                            optionally followed by a sequence of digits 0 
  3340.                            through 7.  A hexadecimal constant starts with 0x or 
  3341.                            0X followed by a sequence of the decimal digits and 
  3342.                            letters (a(A) to f(F)). 
  3343.  
  3344.            2 through 36    The subject string is a sequence of letters and 
  3345.                            digits representing an integer in the radix 
  3346.                            specified by the base parameter, optionally preceded 
  3347.                            by a plus or minus sign, but not including an 
  3348.                            integer suffix.  The letters a(A) through z(Z) are 
  3349.                            ascribed the values 10 to 35. Only letters whose 
  3350.                            values are less than that of the specified base are 
  3351.                            permitted.  If the value of base is 16, the 
  3352.                            characters 0x or 0X may optionally precede the 
  3353.                            sequence of letters or digits, following the sign if 
  3354.                            present. 
  3355.  
  3356.  
  3357.  Return Values 
  3358.  
  3359.  long integer   The converted value of unsigned long integer if expected form 
  3360.                 is found. 
  3361.  
  3362.  0              No conversion could be performed.  Global variable errno is set 
  3363.                 to EINVAL.  The value of base may not be supported. 
  3364.  
  3365.  LONG_MAX       Converted value is outside the range of representable values. 
  3366.                 Global variable errno is set to ERANGE. 
  3367.  
  3368.  LONG_MIN       Converted value is outside the range of representable values. 
  3369.  
  3370.  Since 0, LONG_MIN, and LONG_MAX are returned in the event of an error and are 
  3371.  also valid returns if this function is successful, applications should set the 
  3372.  errno global variable to 0 before calling this function, and then check the 
  3373.  errno global variable after return.  Then, if the errno global variable has 
  3374.  changed, an error occurred. 
  3375.  
  3376.  
  3377.  Related Information 
  3378.  
  3379.      iswspace - Checks for a valid wide-character space. 
  3380.      wcstod  - Converts a wide-character string to a double-precision number. 
  3381.      wsctol  - Converts wide-character strings to unsigned long integer. 
  3382.      wchar.h  - Header file for wide-character function prototypes. 
  3383.  
  3384.  
  3385.  Example 
  3386.  
  3387.  This example converts a wide-character string to an unsigned long integer. 
  3388.  
  3389.   #include <stdio.h>
  3390.   #include <wchar.h>
  3391.  
  3392.   #define SIZE  40
  3393.  
  3394.   main()
  3395.   {
  3396.  
  3397.     wchar_t WCString[SIZE],
  3398.             *endptr;
  3399.  
  3400.     unsigned long int retval;
  3401.  
  3402.     /** Set errno to 0 so a failure for wcstoul can be **detected */
  3403.     errno=0;
  3404.  
  3405.     mbstowcs(WCString,"100000",SIZE);
  3406.  
  3407.     /*
  3408.      ** Let WCString point to a wide-character null terminated
  3409.      ** string containing an unsigned long integer value
  3410.      **
  3411.     */
  3412.  
  3413.     retval = wcstoul ( WCString, &endptr, 10 );
  3414.     /* Check errno, if it is non-zero, wcstoul failed */
  3415.     if (errno != 0)
  3416.     {
  3417.       /*Error handling*/
  3418.       printf("An error occurred during conversion\n");
  3419.     }
  3420.     else if (retval == ULONG_MAX)
  3421.     {
  3422.       /* No conversion could be performed */
  3423.       /* Handle this case accordingly. */
  3424.       printf("No conversion could be performed\n");
  3425.     }
  3426.     /* retval contains unsigned long integer */
  3427.     printf("This should be an unsigned long integer %ld\n",retval);
  3428.   }
  3429.  
  3430.  
  3431. ΓòÉΓòÉΓòÉ 8.8. wctomb -- Convert wide-character to multibyte character ΓòÉΓòÉΓòÉ
  3432.  
  3433.  
  3434. Syntax 
  3435.  
  3436. #include <wchar.h>
  3437.  
  3438. int wctomb(char *string, wchar_t character);
  3439.  
  3440.  
  3441. Description. 
  3442.  
  3443. The wctomb function converts the wide-character in character to a multibyte 
  3444. character and stores it in string.  If the value of character is 0, the 
  3445. function is left in the initial shift state.  At most, wctomb stores MB_CUR_MAX 
  3446. characters in string. 
  3447.  
  3448.  
  3449. Parameters 
  3450.  
  3451.  character Wide-character to be converted. 
  3452.  
  3453.  string    Pointer to target buffer. 
  3454.  
  3455.  
  3456.  Return Values 
  3457.  
  3458.  If string is NULL, the wctomb function returns: 
  3459.  
  3460.      Nonzero when encodings have state dependency 
  3461.  
  3462.      0 otherwise. 
  3463.  
  3464.  If string is not NULL, the wctomb function returns: 
  3465.  
  3466.      The number of bytes comprising the converted multi-byte character 
  3467.  
  3468.      -1 if the value of character does not correspond to a valid multi-byte 
  3469.       character. 
  3470.  
  3471.  
  3472.  Related Information 
  3473.  
  3474.      mbtowc  - Convert Multibyte Character to wchar_t. 
  3475.      wcslen  - Calculate Length of wchar_t String. 
  3476.      wcstombs  - Convert wchar_t String to Multibyte Character String. 
  3477.      wchar.h - Header file for wide charcter prototypes. 
  3478.  
  3479.  
  3480.  Example 
  3481.  
  3482.  This example converts the wide-character c to a character. 
  3483.  
  3484.   #include <stdio.h>
  3485.   #include <wchar.h>
  3486.  
  3487.   #define SIZE 40
  3488.  
  3489.   int main(void) {
  3490.       static char  buffer[ SIZE ];
  3491.       wchar_t wch = 'c';
  3492.       int length;
  3493.  
  3494.       length = wctomb( buffer, wch );
  3495.  
  3496.       printf( "\nThis multibyte character is (%d) byte(s) long", length);
  3497.       printf( "And the converted string is \"%s\"\n", buffer );
  3498.       }
  3499.  
  3500.  
  3501.   /****************  Output should be similar to:  ******************
  3502.  
  3503.   This multibyte character is 1 byte(s) long
  3504.   And the converted string is "c"
  3505.  
  3506.   *******************************************************************/
  3507.  
  3508.  
  3509. ΓòÉΓòÉΓòÉ 9. Formatted I/O Functions ΓòÉΓòÉΓòÉ
  3510.  
  3511. Formatted I/O Functions: 
  3512.  
  3513.  
  3514.     fscanf/scanf/sscanf with %ws, %wc decoding, and parameter
  3515.                         reordering via the (%n$x) format
  3516.  
  3517.     fprintf/printf/sprintf with %ws, %wc encoding, and parameter
  3518.                            reordering via the (%n$x) format
  3519.  
  3520.  
  3521. ΓòÉΓòÉΓòÉ 9.1. fprintf -- Formats output to an output stream ΓòÉΓòÉΓòÉ
  3522.  
  3523.  
  3524. Syntax 
  3525.  
  3526. #include <stdio.h>
  3527.  
  3528. int fprintf(FILE *stream, const char *format-string, argument-list);
  3529.  
  3530.  
  3531. Description 
  3532.  
  3533. The fprintf function formats and writes a series of characters and values to 
  3534. the output stream.  It converts each entry in argument-list, if any, and writes 
  3535. to the stream according to the corresponding format specification in the 
  3536. format-string. Each entry in argument-list must be a pointer to a variable with 
  3537. a type that corresponds to a type specifier in format-string. 
  3538.  
  3539. The format-string has the same form and function as the format-string argument 
  3540. for the printf function. 
  3541.  
  3542. In extended mode, fprintf also converts floating-point values of NaN and 
  3543. infinity to the strings "NAN" or "nan" and "INFINITY" or "infinity". The case 
  3544. and sign of the string is determined by the format specifiers.  See Infinity 
  3545. and NaN Support for more information on infinity and NaN values. 
  3546.  
  3547.  
  3548. Parameters 
  3549.  
  3550.  stream          Output stream into which data is written. 
  3551.  
  3552.  format-string   Format specification. See printf. 
  3553.  
  3554.  argument-list   List of arguments to be substituted into the formatted data. 
  3555.  
  3556.  
  3557.  Return Values 
  3558.  
  3559.  The fprintf function returns the number of characters written or a negative 
  3560.  value if an output error occurs. 
  3561.  
  3562.  
  3563.  Related Information 
  3564.  
  3565.      fscanf  - Read Formatted Data. 
  3566.      printf  - Formatted Print. 
  3567.      sprintf  - Formatted Print to Buffer. 
  3568.      stdio.h  - Include file for standard I/O functions. 
  3569.  
  3570.  
  3571.  Example 
  3572.  
  3573.  This example stores a series of data types to a file "myfile.dat" using the 
  3574.  fprintf function. 
  3575.  
  3576.   #include <stdio.h>
  3577.   #include <wchar.h>
  3578.  
  3579.   #define MAXLEN  80
  3580.  
  3581.   int main(void) {
  3582.       int count;
  3583.       FILE *stream;
  3584.       long l;
  3585.       float fp;
  3586.       wchar_t s[MAXLEN];
  3587.       wchar_t c[MAXLEN];
  3588.  
  3589.       fp = 1.34e-2;
  3590.  
  3591.       l = 1000000;
  3592.  
  3593.       mbstowcs(s,"ABCDEFGHIJKLMNOPQRSTUVWXYZ",MAXLEN);
  3594.       mbstowcs(c,"A",MAXLEN);
  3595.  
  3596.       stream = fopen("myfile.dat", "w");
  3597.  
  3598.       fprintf(stream, "%S", s);
  3599.       fprintf(stream, "%ld", l);
  3600.       fprintf(stream, "%C", c[0]);
  3601.       fprintf(stream, "%f", fp);
  3602.  
  3603.       printf("\n");
  3604.  
  3605.       fclose(stream);
  3606.       }
  3607.  
  3608.  
  3609. ΓòÉΓòÉΓòÉ 9.2. fscanf -- Reads data from a stream and returns data to argument list ΓòÉΓòÉΓòÉ
  3610.  
  3611.  
  3612. Syntax 
  3613.  
  3614. #include <stdio.h> /* when using C set 2 the header file is <wchar.h> */
  3615.  
  3616. int fscanf (FILE *stream, const char *format-string, argument-list);
  3617.  
  3618. Description 
  3619.  
  3620. The fscanf function reads data from the current position of the specified 
  3621. stream into the locations given by the entries in argument-list, if any.  Each 
  3622. entry in argument-list must be a pointer to a variable with a type that 
  3623. corresponds to a type specifier in format-string. 
  3624.  
  3625. The format-string controls the interpretation of the input fields and has the 
  3626. same form and function as the format-string argument for the scanf function. 
  3627. See scanf for a description of format-string. 
  3628.  
  3629. In extended mode, the fscanf function also reads in the strings "INFINITY", 
  3630. "INF", and "NAN" (in upper or lowercase) and converts them to the corresponding 
  3631. floating-point value.  The sign of the value is determined by the format 
  3632. specification. See Infinity and NaN Support for more information on infinity 
  3633. and NaN values. 
  3634.  
  3635.  New Formatting Codes 
  3636.  
  3637. Using the n$ feature the order of arguments referenced can be changed. For 
  3638. example, take the following statement: 
  3639.  
  3640.        fscanf(stream,"%d %d",&value1, &value2);
  3641.  
  3642. By using the n$ format the value2 could be referenced before value1: 
  3643.  
  3644.        fscanf(stream,"%2$d %1$d",&value1,&value2).
  3645.  
  3646. The %S is used to print wide-character strings for wide-character support. 
  3647.  
  3648. The %C is used to print individual wide-characters for wide-character support. 
  3649.  
  3650.  
  3651. Parameters 
  3652.  
  3653.  stream          Input stream from which data is read. 
  3654.  
  3655.  format-string   Format specification. See scanf. 
  3656.  
  3657.  argument-list   List of arguments to be substituted into the formatted data. 
  3658.  
  3659.  
  3660.  Return Values 
  3661.  
  3662.  The fscanf function returns the number of fields that it successfully 
  3663.  converted and assigned.  The return value does not include fields that fscanf 
  3664.  read but did not assign. 
  3665.  
  3666.  If an input failure occurs before any conversion, the return value is EOF. 
  3667.  
  3668.  
  3669.  Related Information 
  3670.  
  3671.      fprintf - Write Formatted Data 
  3672.      scanf  - Read Data 
  3673.      stdio.h - Normal location for fscanf function prototype, however for this 
  3674.       implementation uses wchar.h. 
  3675.      wchar.h  - Header file for wide-character support. 
  3676.  
  3677.  
  3678.  Example 
  3679.  
  3680.  This example opens the file myfile.dat for reading and then scans this file 
  3681.  for a string, a long integer value, a character, and a floating-point value. 
  3682.  
  3683.   #include <stdio.h>
  3684.   #include <stdlib.h>
  3685.   #include <wchar.h>
  3686.  
  3687.   #define MAXLEN  80
  3688.  
  3689.   int main(void) {
  3690.       int count;
  3691.       FILE *stream;
  3692.       long l;
  3693.       float fp;
  3694.       wchar_t s[MAXLEN];
  3695.       wchar_t c;
  3696.  
  3697.       for(count=0;count<MAXLEN;count++){s[count]=0;};
  3698.  
  3699.       stream = fopen("myfile.dat", "r");
  3700.  
  3701.       fscanf(stream, "%26C", &s);
  3702.       fscanf(stream, "%ld", &l);
  3703.       fscanf(stream, "%C", &c);
  3704.       fscanf(stream, "%f", &fp);
  3705.  
  3706.       printf("string = %S\n", s);
  3707.       printf("long double = %ld\n", l);
  3708.       printf("char = %C\n", c);
  3709.       printf("float = %f\n", fp);
  3710.  
  3711.       printf("\n");
  3712.  
  3713.       fclose(stream);
  3714.       }
  3715.  
  3716.  
  3717.   /***************  If myfile.dat contains  ********************
  3718.  
  3719.            ABCDEFGHIJKLMNOPQRSTUVWXYZ1000000A0.013400
  3720.  
  3721.   *******************  expected output is:  ********************
  3722.  
  3723.   string = ABCDEFGHIJKLMNOPQRSTUVWXYZ
  3724.   long double = 1000000
  3725.   char = A
  3726.   float = 0.013400
  3727.  
  3728.   **************************************************************/
  3729.  
  3730.  
  3731. ΓòÉΓòÉΓòÉ 9.3. printf -- Format and print characters ΓòÉΓòÉΓòÉ
  3732.  
  3733.  
  3734. Syntax 
  3735.  
  3736. #include <stdio.h>
  3737. #include <wchar.h>
  3738.  
  3739. int printf(const char *format-string, ...);
  3740.  
  3741.  
  3742. Description 
  3743.  
  3744. The printf function formats and prints a series of characters and values to the 
  3745. standard output stream stdout.  The format-string consists of ordinary 
  3746. characters, escape sequences, and format specifications.  The ordinary 
  3747. characters are copied in order of their appearance to stdout.  Format 
  3748. specifications, beginning with a percent sign (%), determine the output format 
  3749. for any argument-list following the format-string.  The format-string is a 
  3750. multibyte character string beginning and ending in its initial shift state. 
  3751.  
  3752. The format-string is read left to right.  When the first format specification 
  3753. is found, the value of the first argument after the format-string is converted 
  3754. and output according to the format specification.  The second format 
  3755. specification causes the second argument after the format-string to be 
  3756. converted and output, and so on through the end of the format-string.  If there 
  3757. are more arguments than there are format specifications, the extra arguments 
  3758. are evaluated and ignored.  The results are undefined if there are not enough 
  3759. arguments for all the format specifications.  A format specification has the 
  3760. following form: 
  3761.  
  3762.  
  3763.  
  3764.  --%---------------------------------------------------------type--
  3765.         -         -  -         -  -                -  -     -
  3766.         ---flags---  ---width---  ---.--precision---  ---h---
  3767.                                                       -     -
  3768.                                                       ---L---
  3769.                                                       -     -
  3770.                                                       ---l---
  3771.  
  3772. Each field of the format specification is a single character or number 
  3773. signifying a particular format option.  The type character, which appears after 
  3774. the last optional format field, determines whether the associated argument is 
  3775. interpreted as a character, a string, a number, or pointer.  The simplest 
  3776. format specification contains only the percent sign and a type character (for 
  3777. example, %s). 
  3778.  
  3779. The following optional fields control other aspects of the formatting: 
  3780.  
  3781. Field       Description
  3782.  
  3783. flags       Justification of output and printing of signs, blanks,
  3784.             decimal points, octal, and hexadecimal prefixes, and the
  3785.             semantics for wchar_t precision unit.
  3786.  
  3787. width       Minimum number of characters (bytes) output.
  3788.  
  3789. precision   Maximum number of characters (bytes) printed for all or
  3790.             part of the output field, or minimum number of digits
  3791.             printed for integer values.
  3792.  
  3793. h,l,L       Size of argument expected.
  3794.  
  3795. The type characters and their meanings are given in the following table: 
  3796.  
  3797. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  3798. ΓöéCHARACTERΓöéARGUMENT       ΓöéOUTPUT FORMAT                                       Γöé
  3799. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3800. Γöéd, i     ΓöéInteger        ΓöéSigned decimal integer.                             Γöé
  3801. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3802. Γöéu        ΓöéInteger        ΓöéUnsigned decimal integer.                           Γöé
  3803. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3804. Γöéo        ΓöéInteger        ΓöéUnsigned octal integer.                             Γöé
  3805. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3806. Γöéx        ΓöéInteger        ΓöéUnsigned hexadecimal integer, using abcdef          Γöé
  3807. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3808. ΓöéX        ΓöéInteger        ΓöéUnsigned hexadecimal integer, using ABCDEF          Γöé
  3809. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3810. Γöéf        ΓöéDouble         ΓöéSigned value having the form [-]dddd.dddd, where    Γöé
  3811. Γöé         Γöé               Γöédddd is one or more decimal digits.  The number of  Γöé
  3812. Γöé         Γöé               Γöédigits before the decimal point depends on the      Γöé
  3813. Γöé         Γöé               Γöémagnitude of the number.  The number of digits afterΓöé
  3814. Γöé         Γöé               Γöéthe decimal point is equal to the requested         Γöé
  3815. Γöé         Γöé               Γöéprecision.                                          Γöé
  3816. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3817. Γöée        ΓöéDouble         ΓöéSigned value having the form [-]d.dddd"e"[sign]ddd, Γöé
  3818. Γöé         Γöé               Γöéwhere d is a single-decimal digit, dddd is one or   Γöé
  3819. Γöé         Γöé               Γöémore decimal digits, ddd is 2 or more decimal       Γöé
  3820. Γöé         Γöé               Γöédigits, and sign is + or -.                         Γöé
  3821. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3822. ΓöéE        ΓöéDouble         ΓöéIdentical to the "e" format except that "E"         Γöé
  3823. Γöé         Γöé               Γöéintroduces the exponent instead of "e".             Γöé
  3824. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3825. Γöég        ΓöéDouble         ΓöéSigned value printed in "f" or "e" format.  The "e" Γöé
  3826. Γöé         Γöé               Γöéformat is used only when the exponent of the value  Γöé
  3827. Γöé         Γöé               Γöéis less than -4 or greater than precision.  TrailingΓöé
  3828. Γöé         Γöé               Γöézeros are truncated, and the decimal point appears  Γöé
  3829. Γöé         Γöé               Γöéonly if one or more digits follow it.               Γöé
  3830. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3831. ΓöéG        ΓöéDouble         ΓöéIdentical to the "g" format except that "E"         Γöé
  3832. Γöé         Γöé               Γöéintroduces the exponent (where appropriate instead  Γöé
  3833. Γöé         Γöé               Γöéof "e".                                             Γöé
  3834. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3835. Γöéc        ΓöéCharacter      ΓöéSingle character.                                   Γöé
  3836. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3837. Γöés        ΓöéString         ΓöéCharacters printed up to the first null character   Γöé
  3838. Γöé         Γöé               Γöé(\"0") or until precision is reached.               Γöé
  3839. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3840. Γöén        ΓöéPointer to     ΓöéNumber of characters successfully written so far to Γöé
  3841. Γöé         Γöéinteger        Γöéthe stream or buffer; this value is stored in the   Γöé
  3842. Γöé         Γöé               Γöéinteger whose address is given as the argument.     Γöé
  3843. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3844. Γöép        ΓöéPointer        ΓöéPointer to void converted to a sequence of printableΓöé
  3845. Γöé         Γöé               Γöécharacters.                                         Γöé
  3846. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3847. Γöé"lc"     ΓöéWide Character ΓöéMultibyte character.                                Γöé
  3848. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3849. Γöé"ls"     ΓöéWide string    ΓöéMultibyte characters printed up to the first        Γöé
  3850. Γöé         Γöé               Γöé"wchar_t" null character ("L\0") or until precision Γöé
  3851. Γöé         Γöé               Γöéis reached.                                         Γöé
  3852. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3853. ΓöéC        Γöéwide character ΓöéA wchar_t character is converted into an array of   Γöé
  3854. Γöé         Γöéto Multibyte   Γöécharacters representing an multibyte character and  Γöé
  3855. Γöé         Γöé               Γöéthis character is printed out.  Same result as      Γöé
  3856. Γöé         Γöé               Γöéwctomb().                                           Γöé
  3857. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3858. ΓöéS        ΓöéWide character ΓöéTakes a pointer to an array of wchar_t characters   Γöé
  3859. Γöé         Γöésting to       Γöéand converts it to an array of multibyte characters Γöé
  3860. Γöé         ΓöéMultibyte      Γöéupto but not including the null character and printsΓöé
  3861. Γöé         Γöéstring         Γöéthe result.  Same result as wcstombs().             Γöé
  3862. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  3863.  
  3864. The flag characters and their meanings are as follows (notice that more than 
  3865. one flag can appear in a format specification): 
  3866.  
  3867. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  3868. ΓöéFLAG      ΓöéMEANING                                    ΓöéDEFAULT                Γöé
  3869. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3870. Γöé-         ΓöéLeft-justify the result within the field   ΓöéRight-justify.         Γöé
  3871. Γöé          Γöéwidth.                                     Γöé                       Γöé
  3872. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3873. Γöé+         ΓöéPrefix the output value with a sign (+ or  ΓöéSign appears only for  Γöé
  3874. Γöé          Γöé-) if the output value is of a signed type.Γöénegative signed values Γöé
  3875. Γöé          Γöé                                           Γöé(-).                   Γöé
  3876. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3877. Γöéblank(' ')ΓöéPrefix the output value with a blank if theΓöéNo blank.              Γöé
  3878. Γöé          Γöéoutput value is signed and positive. The   Γöé                       Γöé
  3879. Γöé          Γöé"+" flag over-   - rides the blank flag if Γöé                       Γöé
  3880. Γöé          Γöéboth appear, and a positive signed value   Γöé                       Γöé
  3881. Γöé          Γöéwill be output with a sign.                Γöé                       Γöé
  3882. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3883. Γöé#         ΓöéWhen used with the "o", "x", or "X"        ΓöéNo prefix.             Γöé
  3884. Γöé          Γöéformats, the "#" flag prefixes any nonzero Γöé                       Γöé
  3885. Γöé          Γöéoutput value with "0", "0"x, or "0"X,      Γöé                       Γöé
  3886. Γöé          Γöérespectively.                              Γöé                       Γöé
  3887. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3888. Γöé#         ΓöéWhen used with the "f", "e", or "E"        ΓöéDecimal point appears  Γöé
  3889. Γöé          Γöéformats, the "#" flag forces the output    Γöéonly if digits follow  Γöé
  3890. Γöé          Γöévalue to contain a decimal point in all    Γöéit.                    Γöé
  3891. Γöé          Γöécases.                                     Γöé                       Γöé
  3892. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3893. Γöé#         ΓöéWhen used with the "g" or "G" formats, the ΓöéDecimal point appears  Γöé
  3894. Γöé          Γöé"#" flag forces the output value to containΓöéonly if digits follow  Γöé
  3895. Γöé          Γöéa decimal point in all cases and prevents  Γöéit; trailing zeros are Γöé
  3896. Γöé          Γöéthe truncation of trailing zeros.          Γöétruncated.             Γöé
  3897. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3898. Γöé#         ΓöéWhen used with the "ls" format, the "#"    ΓöéPrecision indicates theΓöé
  3899. Γöé          Γöéflag causes precision to be measured in    Γöémaximum number of bytesΓöé
  3900. Γöé          Γöé"wchar_t" characters.                      Γöéto be output.          Γöé
  3901. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3902. Γöé0         ΓöéWhen used with the "d", "i", "o", "u", "x",ΓöéSpace padding.         Γöé
  3903. Γöé          Γöé"X", "e", "E", "f", "g", or "G" formats,   Γöé                       Γöé
  3904. Γöé          Γöéthe "0" flag causes leading "0"'s to pad   Γöé                       Γöé
  3905. Γöé          Γöéthe output to the field width.  The "0"    Γöé                       Γöé
  3906. Γöé          Γöéflag is ignored if precision is specified  Γöé                       Γöé
  3907. Γöé          Γöéfor an integer or if the "-" flag is speci-Γöé                       Γöé
  3908. Γöé          Γöéfied.                                      Γöé                       Γöé
  3909. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  3910.  
  3911. The # flag should not be used with c, lc, d, i, u, s, or p types. 
  3912.  
  3913. Width is a nonnegative decimal integer controlling the minimum number of 
  3914. characters printed.  If the number of characters in the output value is less 
  3915. than the specified width, blanks are added on the left or the right (depending 
  3916. on whether the - flag is specified) until the minimum width is reached. 
  3917.  
  3918. Width never causes a value to be truncated;  if the number of characters in the 
  3919. output value is greater than the specified width, or width is not given, all 
  3920. characters of the value are printed (subject to the precision specification). 
  3921.  
  3922. For the ls type, width is specified in bytes. If the number of bytes in the 
  3923. output value is less than the specified width, single-byte blanks are added on 
  3924. the left or the right (depending on whether the - flag is specified) until the 
  3925. minimum width is reached. 
  3926.  
  3927. The width specification can be an asterisk (*), in which case an argument from 
  3928. the argument list supplies the value.  The width argument must precede the 
  3929. value being formatted in the argument list. 
  3930.  
  3931. Precision is a nonnegative decimal integer preceded by a period, which 
  3932. specifies the number of characters to be printed or the number of decimal 
  3933. places.  Unlike the width specification, the precision can cause truncation of 
  3934. the output value or rounding of a floating-point value. 
  3935.  
  3936. The precision specification can be an asterisk (*), in which case an argument 
  3937. from the argument list supplies the value.  The precision argument must precede 
  3938. the value being formatted in the argument list. 
  3939.  
  3940. The interpretation of the precision value and the default when the precision is 
  3941. omitted depend upon the type, as shown in the following table: 
  3942.  
  3943. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  3944. ΓöéTYPE      ΓöéMEANING                               ΓöéDEFAULT                     Γöé
  3945. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3946. Γöéi, d, u,  ΓöéPrecision specifies the minimum numberΓöéIf precision is "0" or      Γöé
  3947. Γöéo, x, X   Γöéof digits to be printed. If the numberΓöéomitted entirely, or if the Γöé
  3948. Γöé          Γöéof digits in the argument is less thanΓöéperiod (.) appears without aΓöé
  3949. Γöé          Γöéprecision, the output value is padded Γöénumber following it, the    Γöé
  3950. Γöé          Γöéon the left with zeros. The value is  Γöéprecision is set to 1.      Γöé
  3951. Γöé          Γöénot truncated when the number of      Γöé                            Γöé
  3952. Γöé          Γöédigits exceeds precision.             Γöé                            Γöé
  3953. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3954. Γöéf, e, E   ΓöéPrecision specifies the number of     ΓöéDefault precision is six.   Γöé
  3955. Γöé          Γöédigits to be printed after the decimalΓöéIf precision is "0" or the  Γöé
  3956. Γöé          Γöépoint.  The last digit printed is     Γöéperiod appears without a    Γöé
  3957. Γöé          Γöérounded.                              Γöénumber following it, no     Γöé
  3958. Γöé          Γöé                                      Γöédecimal point is printed.   Γöé
  3959. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3960. Γöég, G      ΓöéPrecision specifies the maximum numberΓöéAll significant digits are  Γöé
  3961. Γöé          Γöéof significant digits printed.        Γöéprinted.                    Γöé
  3962. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3963. Γöéc         ΓöéNo effect.                            ΓöéThe character is printed.   Γöé
  3964. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3965. Γöélc        ΓöéNo effect.                            ΓöéThe "wchar_t" character is  Γöé
  3966. Γöé          Γöé                                      Γöéprinted.                    Γöé
  3967. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3968. Γöés         ΓöéPrecision specifies the maximum numberΓöéCharacters are printed untilΓöé
  3969. Γöé          Γöéof characters to be printed.          Γöéa null character is         Γöé
  3970. Γöé          ΓöéCharacters in excess of precision are Γöéencountered.                Γöé
  3971. Γöé          Γöénot printed.                          Γöé                            Γöé
  3972. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  3973. Γöéls        ΓöéPrecision specifies the maximum numberΓöé"wchar_t" characters are    Γöé
  3974. Γöé          Γöéof bytes to be printed. Bytes in      Γöéprinted until a null        Γöé
  3975. Γöé          Γöéexcess of precision are not printed;  Γöécharacter is encountered.   Γöé
  3976. Γöé          Γöéhowever, multibyte integrity is alwaysΓöé                            Γöé
  3977. Γöé          Γöépreserved.                            Γöé                            Γöé
  3978. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  3979.  
  3980. The h, l, and L characters specify the size of the expected argument.  Their 
  3981. meanings are as follows: 
  3982.  
  3983.  h  A prefix with the integer types d, i, o, u, x, X, and n that specifies that 
  3984.     the argument is short int or unsigned short int. 
  3985.  
  3986.  l  A prefix with d, i, o, u, x, X, and n types that specifies that the 
  3987.     argument is a long int or unsigned long int. 
  3988.  
  3989.  L  A prefix with e, E, f, g, or G types that specifies that the argument is 
  3990.     long double. 
  3991.  
  3992.  If a percent sign (%) is followed by a character that has no meaning as a 
  3993.  format field, the character is simply copied to stdout.  For example, to print 
  3994.  a percent sign character, use %%. 
  3995.  
  3996.  The printf function returns the number of characters (bytes) printed. 
  3997.  
  3998.  
  3999.  Related Information 
  4000.  
  4001.      fprintf - Write Formatted Data 
  4002.      fscanf  - Read Formatted Data 
  4003.      scanf  - Read Data 
  4004.      sprintf - Formatted Print to Buffer 
  4005.      sscanf  - Read Data 
  4006.      stdio.h 
  4007.  
  4008.  Example 
  4009.  
  4010.  This example prints data in a variety of formats. 
  4011.  
  4012.   #include <stdio.h>
  4013.   #include <wchar.h>
  4014.  
  4015.   int main(void) {
  4016.       char ch = 'h', *string = "computer";
  4017.       int count = 234, hex = 0x10, oct = 010, dec = 10;
  4018.       double fp = 251.7366;
  4019.       wchar_t wc = (wchar_t)0x0058;
  4020.       wchar_t ws[4];
  4021.  
  4022.       ws[0] = (wchar_t)0x0041;
  4023.       ws[1] = (wchar_t)0x0042;
  4024.       ws[2] = (wchar_t)0x0043;
  4025.       ws[3] = (wchar_t)0x0000;
  4026.  
  4027.       printf("%d   %+d    %06d     %X    %x     %o\n\n",
  4028.           count, count, count, count, count, count);
  4029.  
  4030.       printf("1234567890123%n4567890123456789\n\n", &count);
  4031.       printf("Value of count should be 13; count = %d\n\n", count);
  4032.       printf("%10c%5c\n", ch, ch);
  4033.       printf("%25s\n%25.4s\n\n", string, string);
  4034.       printf("%f    %.2f    %e    %E\n\n", fp, fp, fp, fp);
  4035.       printf("%i    %i     %i\n\n", hex, oct, dec);
  4036.       printf("%C    %S\n\n",wc,ws);
  4037.       printf("%2$C    %1$2S\n\n",ws,wc);
  4038.       }
  4039.  
  4040.   /*****************  Output should be similar to:  *****************
  4041.  
  4042.   234   +234    000234     EA    ea     352
  4043.  
  4044.   12345678901234567890123456789
  4045.  
  4046.   Value of count should be 13; count = 13
  4047.  
  4048.     h    h
  4049.             computer
  4050.                 comp
  4051.  
  4052.   251.736600    251.74    2.517366e+02    2.517366E+02
  4053.  
  4054.   16    8     10
  4055.  
  4056.   X     ABC
  4057.  
  4058.   X     AB
  4059.  
  4060.   *******************************************************************/
  4061.  
  4062.  
  4063. ΓòÉΓòÉΓòÉ 9.4. scanf -- Reads formatted data from the standard input ΓòÉΓòÉΓòÉ
  4064.  
  4065.  
  4066. Syntax 
  4067.  
  4068. #include <stdio.h>
  4069. #include <wchar.h>
  4070.  
  4071. int scanf(const char *format-string, argument-list);
  4072.  
  4073. Description 
  4074.  
  4075. The scanf function reads data from the standard input stream stdin into the 
  4076. locations given by each entry in argument-list. Each argument must be a pointer 
  4077. to a variable with a type that corresponds to a type specifier in 
  4078. format-string.  The format-string controls the interpretation of the input 
  4079. fields, and is a multibyte character string beginning and ending in its initial 
  4080. shift state. 
  4081.  
  4082. The format-string can contain one or more of the following: 
  4083.  
  4084.      White-space characters, as specified by isspace (such as blanks and 
  4085.       new-line characters). A white-space character causes scanf to read, but 
  4086.       not to store, all consecutive white-space characters in the input up to 
  4087.       the next character that is not white-space.  One white-space character in 
  4088.       format-string matches any combination of white-space characters in the 
  4089.       input. 
  4090.  
  4091.      Characters that are not white space, except for the percent sign 
  4092.       character (%).  A non-white-space character causes scanf to read, but not 
  4093.       to store, a matching non-white-space character.  If the next character in 
  4094.       stdin does not match, scanf ends. 
  4095.  
  4096.      Format specifications, introduced by the percent sign (%).  A format 
  4097.       specification causes scanf to read and convert characters in the input 
  4098.       into values of a specified type.  The value is assigned to an argument in 
  4099.       the argument list. 
  4100.  
  4101.  The scanf function reads format-string from left to right. Characters outside 
  4102.  of format specifications are expected to match the sequence of characters in 
  4103.  stdin;  the matched characters in stdin are scanned but not stored.  If a 
  4104.  character in stdin conflicts with format-string, scanf ends.  The conflicting 
  4105.  character is left in stdin as if it had no been read. 
  4106.  
  4107.  When the first format specification is found, the value of the first input 
  4108.  field is converted according to the format specification and stored in the 
  4109.  location specified by the first entry in argument-list. The second format 
  4110.  specification converts the second input field and stores it in the second 
  4111.  entry in argument-list, and so on through the end of format-string. 
  4112.  
  4113.  An input field is defined as all characters up to the first white-space 
  4114.  character (space, tab, or new line), up to the first character that cannot be 
  4115.  converted according to the format specification, or until the field width is 
  4116.  reached, whichever comes first.  If there are too many arguments for the 
  4117.  format specifications, the extra arguments are ignored.  The results are 
  4118.  undefined if there are not enough arguments for the format specifications. 
  4119.  
  4120.  A format specification has the following form: 
  4121.  
  4122.  
  4123.  
  4124.    --%---------------------------------type--
  4125.           -     -  -         -  -     -
  4126.           ---*---  ---width---  ---h---
  4127.                                 -     -
  4128.                                 ---l---
  4129.                                 -     -
  4130.                                 ---L---
  4131.  
  4132.  Each field of the format specification is a single character or a number 
  4133.  signifying a particular format option.  The type character, which appears 
  4134.  after the last optional format field, determines whether the input field is 
  4135.  interpreted as a character, a string, or a number.  The simplest format 
  4136.  specification contains only the percent sign and a type character (for 
  4137.  example, %s). 
  4138.  
  4139.  Each field of the format specification is discussed in scanf Format Tags. If a 
  4140.  percent sign (%) is followed by a character that has no meaning as a format 
  4141.  control character, that character and following characters up to the next 
  4142.  percent sign are treated as an ordinary sequence of characters;  that is, a 
  4143.  sequence of characters that must match the input.  For example, to specify a 
  4144.  percent-sign character, use %%. 
  4145.  
  4146.  The scanf function scans each input field character by character. It might 
  4147.  stop reading a particular input field either before it reaches a space 
  4148.  character, when the specified width is reached, or when the next character 
  4149.  cannot be converted as specified.  When a conflict occurs between the 
  4150.  specification and the input character, the next input field begins at the 
  4151.  first unread character.  The conflicting character, if there was one, is 
  4152.  considered unread and is the first character of the next input field or the 
  4153.  first character in subsequent read operations on stdin. 
  4154.  
  4155.  The scanf function returns the number of fields that were successfully 
  4156.  converted and assigned.  The return value does not include fields that were 
  4157.  read but not assigned. 
  4158.  
  4159.  The return value is EOF for an attempt to read at end-of-file if no conversion 
  4160.  was performed. A return value of 0 means that no fields were assigned. 
  4161.  
  4162.  
  4163.  scanf Format Tags 
  4164.  
  4165.  The scanf format specification fields are described below. 
  4166.  
  4167.  *         An asterisk (*) following the percent sign suppresses assignment of 
  4168.            the next input field, which is interpreted as a field of the 
  4169.            specified type.  The field is scanned but not stored. 
  4170.  
  4171.  width     The width is a positive decimal integer controlling the maximum 
  4172.            number of characters to be read from stdin. No more than width 
  4173.            characters are converted and stored at the corresponding argument. 
  4174.            Fewer than width characters are read if a white-space character 
  4175.            (space, tab, or new line), or a character that cannot be converted 
  4176.            according to the given format occurs before width is reached. 
  4177.  
  4178.  h, l, L   The optional prefix l(ell) shows that you use the long version of 
  4179.            the following type, while the prefix h indicates that the short 
  4180.            version is to be used.  The corresponding argument should point to a 
  4181.            long or double object (for the l character), a long double object 
  4182.            (for the L character), or a short object (with the h character). 
  4183.            The l and h modifiers can be used with the d, i, o, x, and u type 
  4184.            characters. The l modifier can also be used with the e, f, and g 
  4185.            type characters.  The L modifier can be used with the e, f and g 
  4186.            type characters. The l and h modifiers are ignored if specified for 
  4187.            any other type. Note that the l modifier is also used with the c and 
  4188.            s characters to indicate a multibyte character or string. 
  4189.  
  4190.  type      The type characters and their meanings are in the following table: 
  4191.  
  4192.                       ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  4193.                       ΓöéCHARACTER ΓöéTYPE OF INPUT EXPECTED        ΓöéTYPE OF ARGUMENT              Γöé
  4194.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4195.                       Γöé"d"       ΓöéDecimal integer               ΓöéPointer to "int"              Γöé
  4196.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4197.                       Γöé"o"       ΓöéOctal integer                 ΓöéPointer to "unsigned int"     Γöé
  4198.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4199.                       Γöé"x", "X"  ΓöéHexadecimal integer           ΓöéPointer to "unsigned int"     Γöé
  4200.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4201.                       Γöé"i"       ΓöéDecimal, hexadecimal, or octalΓöéPointer to "int"              Γöé
  4202.                       Γöé          Γöéinteger                       Γöé                              Γöé
  4203.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4204.                       Γöé"u"       ΓöéUnsigned decimal integer      ΓöéPointer to "unsigned int"     Γöé
  4205.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4206.                       Γöé"e", "f", ΓöéFloating point value          ΓöéPointer to "float"            Γöé
  4207.                       Γöé"g", "E", Γöéconsisting of an optional signΓöé                              Γöé
  4208.                       Γöé"G"       Γöé(+ or -); a series of one or  Γöé                              Γöé
  4209.                       Γöé          Γöémore decimal digits possibly  Γöé                              Γöé
  4210.                       Γöé          Γöécontaining a decimal point;   Γöé                              Γöé
  4211.                       Γöé          Γöéand an optional exponent (e orΓöé                              Γöé
  4212.                       Γöé          ΓöéE0 followed by a possibly     Γöé                              Γöé
  4213.                       Γöé          Γöésigned integer value          Γöé                              Γöé
  4214.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4215.                       Γöé"c"       ΓöéCharacter; white-space        ΓöéPointer to "char" large enoughΓöé
  4216.                       Γöé          Γöécharacters that are ordinarilyΓöéfor input field               Γöé
  4217.                       Γöé          Γöéskipped are read when "c" is  Γöé                              Γöé
  4218.                       Γöé          Γöéspecified                     Γöé                              Γöé
  4219.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4220.                       Γöé"s"       ΓöéString                        ΓöéPointer to character array    Γöé
  4221.                       Γöé          Γöé                              Γöélarge enough for input field  Γöé
  4222.                       Γöé          Γöé                              Γöéplus a terminating null       Γöé
  4223.                       Γöé          Γöé                              Γöécharacger ("\0"), which is    Γöé
  4224.                       Γöé          Γöé                              Γöéautomatically appended        Γöé
  4225.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4226.                       Γöé"n"       ΓöéNo input read from stream or  ΓöéPointer to "int", into which  Γöé
  4227.                       Γöé          Γöébuffer                        Γöéis stored the number of       Γöé
  4228.                       Γöé          Γöé                              Γöécharacters successfully read  Γöé
  4229.                       Γöé          Γöé                              Γöéfrom the stream or buffer up  Γöé
  4230.                       Γöé          Γöé                              Γöéto that point in the call to  Γöé
  4231.                       Γöé          Γöé                              Γöé"scanf"                       Γöé
  4232.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4233.                       Γöé"p"       ΓöéPointer to "void" converted toΓöéPointer to "void"             Γöé
  4234.                       Γöé          Γöéseries of characters          Γöé                              Γöé
  4235.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4236.                       Γöé"lc"      ΓöéMultibyte character constant  ΓöéPointer to "wchar_t"          Γöé
  4237.                       Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  4238.                       Γöé"ls"      ΓöéMultibyte string constant     ΓöéPointer to "wchar_t" string   Γöé
  4239.                       ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  4240.  
  4241.  To read strings not delimited by space characters, substitute a set of 
  4242.  characters in brackets ([ ]) for the s (string) type character.  The 
  4243.  corresponding input field is read up to the first character that does not 
  4244.  appear in the bracketed character set.  If the first character in the set is a 
  4245.  caret (^), the effect is reversed:  the input field is read up to the first 
  4246.  character that does appear in the rest of the character set. 
  4247.  
  4248.  To store a string without storing an ending NULL character (\0), use the 
  4249.  specification %ac, where a is a decimal integer.  In this instance, the c type 
  4250.  character means that the argument is a pointer to a character array.  The next 
  4251.  a characters are read from the input stream into the specified location, and 
  4252.  no NULL character is added. 
  4253.  
  4254.  The input for a %x format specifier is interpreted as a hexadecimal number. 
  4255.  
  4256.  
  4257.  Related Information 
  4258.  
  4259.      fscanf - Read Formatted Data 
  4260.      printf - Formatted Print 
  4261.      sscanf - Read Data 
  4262.      wchar.h 
  4263.  
  4264.  Example 
  4265.  
  4266.  This example scans various types of data: 
  4267.  
  4268.   #include <wchar.h>
  4269.  
  4270.   int main(void) {
  4271.       int i;
  4272.       float fp;
  4273.       char c, s[81];
  4274.       wchar_t wc;
  4275.       wchar_t ws[81];
  4276.  
  4277.       printf("Enter an integer, a real number, a character, a string,\n"
  4278.          "a multi-byte character, and a multi-byte string : \n");
  4279.  
  4280.       if (scanf("%d %f %c %s %C %S", &i, &fp, &c, s, &wc, ws) != 6)
  4281.         printf("Not all of the fields were assigned\n");
  4282.       else {
  4283.         printf("integer = %d\n", i);
  4284.         printf("real number = %f\n", fp);
  4285.         printf("character = %c\n", c);
  4286.         printf("string = %s\n",s);
  4287.         printf("wide-character = %C\n", wc);
  4288.         printf("wide-character string = %S\n",ws);
  4289.         }
  4290.       }
  4291.  
  4292.  
  4293.   /*****************  If input is: 12 2.5 a yes,  *******************
  4294.   **************  then output should be similar to:  ****************
  4295.  
  4296.   Enter an integer, a real number, a character and a string :
  4297.   integer = 12
  4298.   real number = 2.500000
  4299.   character = a
  4300.   string = yes
  4301.  
  4302.   *******************************************************************/
  4303.  
  4304.  
  4305. ΓòÉΓòÉΓòÉ 9.5. sprintf -- Formatted print to buffer ΓòÉΓòÉΓòÉ
  4306.  
  4307.  
  4308. Syntax 
  4309.  
  4310. #include <stdio.h>
  4311. #include <wchar.h>
  4312.  
  4313. int sprintf(char *buffer, const char *format-string, ...);
  4314.  
  4315. Description 
  4316.  
  4317. The sprintf function formats and stores a series of characters and values in 
  4318. the array buffer. Any argument-list is converted and put out according to the 
  4319. corresponding format specification in the format-string. 
  4320.  
  4321. The format-string consists of ordinary characters and has the same form and 
  4322. function as the format-string argument for the printf function.  See printf for 
  4323. a description of the format-string and arguments. 
  4324.  
  4325. The sprintf function returns the number of characters written in the array, not 
  4326. counting the ending null character. 
  4327.  
  4328.  
  4329. Related Information 
  4330.  
  4331.      fprintf - Write Formatted Data 
  4332.      printf  - Formatted Print 
  4333.      sscanf  - Read Data 
  4334.      wchar.h 
  4335.  
  4336.  Example 
  4337.  
  4338.  This example formats several data values to a buffer and prints out the 
  4339.  results using printf. 
  4340.  
  4341.   #include <wchar.h>
  4342.  
  4343.   char buffer[200];
  4344.   int i, j;
  4345.   double fp;
  4346.   char *s = "baltimore";
  4347.   char c;
  4348.  
  4349.   int main(void) {
  4350.       c = 'l';
  4351.       i = 35;
  4352.       fp = 1.7320508;
  4353.  
  4354.       /* Format and print various data */
  4355.  
  4356.       j = sprintf(buffer, "%s\n", s);
  4357.       j += sprintf(buffer+j, "%c\n", c);
  4358.       j += sprintf(buffer+j, "%d\n", i);
  4359.       j += sprintf(buffer+j, "%f\n", fp);
  4360.  
  4361.       printf("\nstring:\n%s\ncharacter count = %d\n", buffer, j);
  4362.  
  4363.       }
  4364.  
  4365.  
  4366.   /*********************  Output should be similar to:  *************
  4367.  
  4368.   string:
  4369.   baltimore
  4370.   l
  4371.   35
  4372.   1.732051
  4373.  
  4374.   character count = 24
  4375.  
  4376.   *******************************************************************/
  4377.  
  4378.  
  4379. ΓòÉΓòÉΓòÉ 9.6. sscanf -- Read data ΓòÉΓòÉΓòÉ
  4380.  
  4381.  
  4382. Syntax 
  4383.  
  4384. #include <wchar.h>
  4385.  
  4386. int sscanf(const char *buffer, const char *format, ...);
  4387.  
  4388. Description 
  4389.  
  4390. The sscanf function reads data from buffer into the locations given by the 
  4391. argument list.  Each argument must be a pointer to a variable with a type that 
  4392. corresponds to a type specifier in the format string. See scanf for a 
  4393. description of the format string. 
  4394.  
  4395. The sscanf function returns the number of fields that were successfully 
  4396. converted and assigned.  The return value does not include fields that were 
  4397. read but not assigned. 
  4398.  
  4399. The return value is WEOF when the end of the string is encountered before 
  4400. anything is converted. 
  4401.  
  4402.  
  4403. Related Information 
  4404.  
  4405.      fscanf  - Read Formatted Data 
  4406.      scanf  - Read Data 
  4407.      sprintf - Formatted Print to Buffer 
  4408.      wchar.h 
  4409.  
  4410.  Example 
  4411.  
  4412.  This example uses sscanf to read various data from the string tokenstring, and 
  4413.  then displays the data. 
  4414.  
  4415.   #include <stdio.h>
  4416.  
  4417.   int main(void) {
  4418.       char    *tokenstring = "15 12 14";
  4419.       wchar_t *widestring = (wchar_t)"ABC Z";
  4420.       wchar_t  ws[81];
  4421.       wchar_t  wc;
  4422.       int   i;
  4423.       float fp;
  4424.       char  s[81];
  4425.       char  c;
  4426.  
  4427.       /* Input various data                              */
  4428.       sscanf(tokenstring, "%s %c%d%f", s, &c, &i, &fp);
  4429.       sscanf(widestring, "0C", ws,&wc);
  4430.       /* If there were no space between %s and %c,       */
  4431.       /* sscanf would read the first character following */
  4432.       /* the string, which is a blank space.             */
  4433.  
  4434.       /* Display the data */
  4435.       printf("\nstring = %s\n",s);
  4436.       printf("character = %c\n",c);
  4437.       printf("integer = %d\n",i);
  4438.       printf("floating-point number = %f\n",fp);
  4439.       printf("wide-character string = %S\n",ws);
  4440.       printf("wide-character = %C\n",wc);
  4441.       }
  4442.  
  4443.  
  4444.   /*****************  Output should be similar to:  *****************
  4445.  
  4446.   string = 15
  4447.   character = 1
  4448.   integer = 2
  4449.   floating-point number = 14.000000
  4450.   wide-character string = ABC
  4451.   wide-character = Z
  4452.  
  4453.   *******************************************************************/
  4454.  
  4455.  
  4456. ΓòÉΓòÉΓòÉ 10. String Collation Functions ΓòÉΓòÉΓòÉ
  4457.  
  4458. The String Collation Functions are: 
  4459.  
  4460.  
  4461.     int strcoll(const char *s1, const char *s2);
  4462.     size_t strxfrm(char *s1, const char *s2, size_t n);
  4463.  
  4464.     int wcscoll(const wchar_t *ws1, const wchar_t *ws2);
  4465.     size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n);
  4466.  
  4467.  
  4468. ΓòÉΓòÉΓòÉ 10.1. strcoll -- Compare character strings ΓòÉΓòÉΓòÉ
  4469.  
  4470.  
  4471. Syntax 
  4472.  
  4473. #include <string.h>
  4474. #include <wchar.h>
  4475.  
  4476. int strcoll(const char *string1, const char *string2);
  4477.  
  4478.  
  4479. Description 
  4480.  
  4481. The strcoll function compares two strings using the collating sequence 
  4482. specified by the program's locale. 
  4483.  
  4484.  
  4485. Parameters 
  4486.  
  4487.  string1   1st string to be compared. 
  4488.  
  4489.  string2   2nd string to be compared. 
  4490.  
  4491.  
  4492.  Return Values 
  4493.  
  4494.  The strcoll function returns a value indicating the relationship between the 
  4495.  strings, as listed below. 
  4496.  
  4497.  Value             Meaning 
  4498.  
  4499.  Less than 0       string1 less than string2 
  4500.  
  4501.  0                 string1 equivalent to string2 
  4502.  
  4503.  Greater than 0    string1 greater than string2 
  4504.  
  4505.  
  4506.  Related Information 
  4507.  
  4508.      setlocale - Set Locale 
  4509.      wcscmp   - Compare wchar_t Strings 
  4510.      wcsncmp  - Compare wchar_t Strings 
  4511.      string.h 
  4512.  
  4513.  
  4514.  Example 
  4515.  
  4516.  This example compares the two strings passed to main. 
  4517.  
  4518.   #include <stdio.h>
  4519.   #include <string.h>
  4520.   #include <wchar.h>
  4521.   #include <locale.h>
  4522.  
  4523.   int main(int argc, char ** argv) {
  4524.       int  result;
  4525.  
  4526.       if ( argc != 3 )
  4527.          printf( "Usage: %s string1 string2\n", argv[0] );
  4528.  
  4529.       else {
  4530.         printf("setlocale set as - %s\n\n",setlocale(LC_ALL,""));
  4531.         result = strcoll( argv[1], argv[2] );
  4532.  
  4533.         if ( result == 0 )
  4534.           printf( "\"%s\" is identical to \"%s\"\n", argv[1], argv[2] );
  4535.         else if ( result < 0 )
  4536.           printf( "\"%s\" is less than \"%s\"\n", argv[1], argv[2] );
  4537.         else
  4538.           printf( "\"%s\" is greater than \"%s\"\n", argv[1], argv[2] );
  4539.         }
  4540.       }
  4541.  
  4542.  
  4543.   /******************  If the input is the strings  ***********************
  4544.   ****************  "firststring" and "secondstring",  ********************
  4545.   *******************  then the expected output is:  **********************
  4546.  
  4547.   "firststring" is less than "secondstring"
  4548.  
  4549.   *************************************************************************/
  4550.  
  4551.  
  4552. ΓòÉΓòÉΓòÉ 10.2. strxfrm -- Character string transformation ΓòÉΓòÉΓòÉ
  4553.  
  4554.  
  4555. Syntax 
  4556.  
  4557. #include <string.h>
  4558. #include <wchar.h>
  4559.  
  4560. size_t strxfrm(char *string1, const char *string2, size_t count);
  4561.  
  4562. Description 
  4563.  
  4564. The strxfrm function transforms the string pointed to by string2 and places the 
  4565. result into the string pointed to by string1.  The transformation is determined 
  4566. by the program's current locale.  The transformed string is not necessarily 
  4567. readable, but can be used with the strcmp or strncmp functions. 
  4568.  
  4569.  
  4570. Parameters 
  4571.  
  4572.  string1   Pointer to target string. 
  4573.  
  4574.  string2   Pointer to source string. 
  4575.  
  4576.  count     Maximum number of bytes placed in the target string including the 
  4577.            null terminator. 
  4578.  
  4579.  
  4580.  Return Values 
  4581.  
  4582.  The strxfrm function returns the length of the transformed string, excluding 
  4583.  the terminating null character.  If the value returned is equal to or greater 
  4584.  than count, the contents of the transformed string are indeterminate. 
  4585.  
  4586.  
  4587.  Related Information 
  4588.  
  4589.      localeconv - Query Locale Conventions 
  4590.      setlocale  - Set Locale 
  4591.      strcmp  - Compare Strings 
  4592.      strcmpi - Compare Strings 
  4593.      strcoll - Compare Strings 
  4594.      stricmp - Compare Strings 
  4595.      strncmp - Compare Strings 
  4596.      strnicmp - Compare Strings 
  4597.      string.h 
  4598.  
  4599.  
  4600.  Example 
  4601.  
  4602.  This example prompts the user to input a string of characters, then uses 
  4603.  strxfrm to transform the string and return its length.  It also shows 
  4604.  collation weights for locale after transformation. 
  4605.  
  4606.   #include <stdio.h>
  4607.   #include <string.h>
  4608.  
  4609.   int main(void) {
  4610.       char *string1, buffer[80];
  4611.       int length;
  4612.       char *s1[8];
  4613.       char *s2[8];
  4614.  
  4615.       printf("Type in a string of characters.\n ");
  4616.  
  4617.       string1 = gets(buffer);
  4618.  
  4619.       length = strxfrm(NULL, string1, 0);
  4620.  
  4621.       printf("You would need a %d element array to hold the string\n",length);
  4622.       printf("\n\n%s\n\n transformed according",string1);
  4623.       printf(" to this program's locale. \n");
  4624.  
  4625.       length = strxfrm(s1,"choice",6);
  4626.       length = strxfrm(s2,"crumby",6);
  4627.  
  4628.       if (strcmp(s1,s2) < 0)
  4629.         printf("\nchoice\ncrumby\n");
  4630.       else
  4631.         printf("\ncrumby\nchoice\n");
  4632.       }
  4633.  
  4634.  
  4635. ΓòÉΓòÉΓòÉ 10.3. wcscoll -- Compare wide-character strings ΓòÉΓòÉΓòÉ
  4636.  
  4637.  
  4638. Syntax 
  4639.  
  4640. #include <wchar.h>
  4641.  
  4642. int wcscoll(const wchar_t *WcString1, const wchar_t *WcString2);
  4643.  
  4644.  
  4645. Description 
  4646.  
  4647. The wcscoll function compares the two wide-character strings pointed to by the 
  4648. WcString1 and WcString2 parameters based on the collation values specified by 
  4649. the LC_COLLATE environment variable of the current locale. 
  4650.  
  4651. Note: The wcscoll function differs from the wcscmp function in that the wcscoll 
  4652. function compares wide-characters based on their collation values, while the 
  4653. wcscmp function compares wide characters based on their ordinal values.  The 
  4654. wcscoll function is less efficient in terms of time than the wcscmp function 
  4655. because of  the overhead of obtaining the collation values from the current 
  4656. locale. 
  4657.  
  4658. The wcscoll function may be unsuccessful if the wide-character strings 
  4659. specified by the WcString1 or WcString2 parameter contains characters outside 
  4660. the domain of the current collating sequence. 
  4661.  
  4662.  
  4663. Parameters 
  4664.  
  4665.  WcString1    Contains a pointer to a wide-character string. 
  4666.  
  4667.  WcString2    Contains a pointer to a wide-character string. 
  4668.  
  4669.  
  4670.  Return Values 
  4671.  
  4672.  Value             Meaning 
  4673.  
  4674.  Less than 0       string1 less than string2 
  4675.  0                 string1 equivalent to string2 
  4676.  Greater than 0    string1 greater than string2 
  4677.  
  4678.  
  4679.  Related Information 
  4680.  
  4681.      wcscmp 
  4682.      wchar.h 
  4683.  
  4684.  
  4685.  Example 
  4686.  
  4687.  This example sets the current locale and compares two wide-character strings 
  4688.  with respect to the current locale. 
  4689.  
  4690.   #include <stdlib.h>
  4691.   #include <stdio.h>
  4692.   #include <wchar.h>
  4693.   #include <locale.h>
  4694.  
  4695.   int main (void) {
  4696.       wchar_t temp1[255], temp2[255];
  4697.       char *s = "crumby";
  4698.       char *t = "choice";
  4699.  
  4700.       printf("\nCalling setlocale\n");
  4701.       printf("Setlocale returns: %s \n", setlocale(LC_ALL, ""));
  4702.  
  4703.       mbstowcs(temp1, s, strlen(s)+1);
  4704.       mbstowcs(temp2, t, strlen(t)+1);
  4705.  
  4706.       if(wcscoll(temp1, temp2) > 0)
  4707.         printf("%S is greater than %S\n",temp1,temp2);
  4708.       else
  4709.         printf("%S is less than %S\n",temp1,temp2);
  4710.  
  4711.       } /* end main */
  4712.  
  4713.  
  4714. ΓòÉΓòÉΓòÉ 10.4. wcsxfrm -- Wide character string transformation ΓòÉΓòÉΓòÉ
  4715.  
  4716.  
  4717. Syntax 
  4718.  
  4719. #include <wchar.h>
  4720.  
  4721. size_t wcsxfrm(wchar_t *WcString1, const wchar_t *WcString2, size_t count);
  4722.  
  4723.  
  4724. Description 
  4725.  
  4726. The wcsxfrm function transforms the wide-character string specified by the 
  4727. WcString2 parameter into a string of wide character codes, based on the 
  4728. collation values of the wide-characters in the current locale as specified by 
  4729. the LC_COLLATE category. No more than the number of character codes specified 
  4730. by the count parameter are copied into the array specified by the WcString1 
  4731. parameter.  This transformation is such that when two such transformed 
  4732. wide-character strings are obtained and the transformed strings are compared 
  4733. using the wcscmp function, the result obtained would be the same as that 
  4734. obtained by a direct call to the wcscoll function on the two original 
  4735. wide-character strings. 
  4736.  
  4737.  
  4738. Parameters 
  4739.  
  4740.  WcString1   Contains a pointer to the destination wide-character string. 
  4741.  
  4742.  WcString2   Contains a pointer to the source wide-character string. 
  4743.  
  4744.  count       Specifies the maximum number of wide-character codes to place into 
  4745.              the array specified by WcString1. 
  4746.  
  4747.  
  4748.  Return Values 
  4749.  
  4750.  If WcString1 is a NULL pointer: 
  4751.  
  4752.      returns the number of wide-character elements (not including the 
  4753.       wide-character null terminator) required to store the transformed 
  4754.       wide-character string. 
  4755.  
  4756.  If WcString1 is not NULL: 
  4757.  
  4758.      If the count specified by the count parameter is sufficient to hold the 
  4759.       transformed string in the WcString1 parameter, including the 
  4760.       wide-character null terminator, the return value is set to the actual 
  4761.       number of wide-character elements placed in the WcString1 parameter, not 
  4762.       including the wide-character null. 
  4763.  
  4764.      If the return value is equal to or greater than the value specified by 
  4765.       the count parameter, the contents of the array pointed to by the 
  4766.       WcString1 parameter are indeterminate.  This occurs whenever the count 
  4767.       parameter value is too small to hold the entire transformed string. 
  4768.  
  4769.      If the wide-character string pointed to by the WcString2 parameter 
  4770.       contains wide-character codes outside  the domain of the collating 
  4771.       sequence defined by the current locale, -1 is returned. 
  4772.  
  4773.  
  4774.  Related Information 
  4775.  
  4776.      wcscmp 
  4777.      wcscoll 
  4778.  
  4779.  
  4780.  Example 
  4781.  
  4782.  This example transforms the wide-character string specified by the "temp2" 
  4783.  parameter into a string of wide-character codes, based on the collation values 
  4784.  of the wide-characters in the current locale as specified by the LC_COLLATE 
  4785.  category. 
  4786.  
  4787.   #include <stdlib.h>
  4788.   #include <stdio.h>
  4789.   #include <wchar.h>
  4790.   #include <locale.h>
  4791.  
  4792.   int main (void) {
  4793.       char *string1 = "Armadillo aerosol chunks";
  4794.       size_t  length, l1, l2;
  4795.       wchar_t wstring[100];
  4796.       wchar_t ws1[50];
  4797.       wchar_t ws2[50];
  4798.       wchar_t wsa[50];
  4799.       wchar_t wsb[50];
  4800.  
  4801.       mbstowcs(wstring,string1,100);
  4802.  
  4803.       printf("\nLocale now set to --> %s",setlocale(LC_ALL,"Es_ES") );
  4804.       length = wcsxfrm(NULL, wstring, 100);
  4805.       printf("\n%d wide-character element array needed to hold the transformed string",length);
  4806.       printf("\n%S\n",wstring);
  4807.  
  4808.       mbstowcs(wsa,"llama",50);
  4809.       mbstowcs(wsb,"lusty",50);
  4810.  
  4811.       l1 = wcsxfrm(ws1,wsa,6);
  4812.       l2 = wcsxfrm(ws2,wsb,6);
  4813.  
  4814.       if (wcscmp(ws1,ws2) < 0)
  4815.         printf("\nlength1-%i-%6S -less than- length2-%i-%6S\n",l1,wsa,l2,wsb);
  4816.       else
  4817.         printf("\nlength2-%i-%6S -less than- length1-%i-%6S\n",l2,wsb,l1,wsa);
  4818.  
  4819.       }
  4820.  
  4821.  
  4822. ΓòÉΓòÉΓòÉ 11. Date/Time and Monetary Formatting Functions ΓòÉΓòÉΓòÉ
  4823.  
  4824. Date and Time Formatting: 
  4825.  
  4826.  
  4827.     size_t strftime(char *s, size_t maxsize, const char *format,
  4828.                     const struct tm *tm);
  4829.  
  4830.     size_t strfmon(char *s, size_t maxsize, const char *format, ...);
  4831.  
  4832.     char  *strptime(const char *buf, const char *fmt, struct tm *tm);
  4833.  
  4834.     size_t wcsftime(wchar_t *wcs, size_t maxsize, const char *format,
  4835.                     const struct tm *tm);
  4836.  
  4837.  
  4838. ΓòÉΓòÉΓòÉ 11.1. strfmon -- Formats monetary strings ΓòÉΓòÉΓòÉ
  4839.  
  4840.  
  4841. Syntax 
  4842.  
  4843. #include <monetary.h>
  4844.  
  4845. ssize_t strfmon(char *s, size_t maxsize, const char *format, ...);
  4846.  
  4847. Description 
  4848.  
  4849. The strfmon function converts numeric values to monetary strings according to 
  4850. the specifications in the format parameter. This parameter also contains 
  4851. numeric values to be converted. Characters are placed into the s array, as 
  4852. controlled by format.  The LC_MONETARY category governs the format of the 
  4853. conversion.  The strfmon function can be called multiple times by including 
  4854. additional format structures. 
  4855.  
  4856.  
  4857. Parameters 
  4858.  
  4859.  s         Pointer to target array. 
  4860.  
  4861.  maxsize   Maximum number of bytes (including the null terminator) that are 
  4862.            placed into the target array. 
  4863.  
  4864.  format    Specifies a character string that can contain plain characters and 
  4865.            conversion specifications.  Plain characters are copied to the 
  4866.            output stream.  Conversion specifications result in the fetching of 
  4867.            zero or more arguments, which are converted and formatted. 
  4868.  
  4869.            If there are insufficient arguments for this parameter, the results 
  4870.            are undefined.  If arguments remain after this parameter is 
  4871.            exhausted, the excess arguments are ignored. 
  4872.  
  4873.   Conversion Specification 
  4874.  
  4875.  A conversion specification consists of the following sequence: 
  4876.  
  4877.      a % (percent sign) character 
  4878.      optional flags 
  4879.      optional field width 
  4880.      optional left precision 
  4881.      optional right precision 
  4882.      a required conversion character that determines the conversion to be 
  4883.       performed. 
  4884.  
  4885.   Flags 
  4886.  
  4887.  One or more of the following optional flags can be specified to control the 
  4888.  conversion: 
  4889.  
  4890.  =f        An = (equal sign) followed by a single character that specifies the 
  4891.            numeric fill character.  The default numeric fill character is the 
  4892.            space character.  This flag does not affect field width filling, 
  4893.            which always uses the space character.  This flag is ignored unless 
  4894.            a left precision is specified. 
  4895.  
  4896.  \^        Does not use grouping characters when formatting the currency 
  4897.            amount.  The default is to insert grouping characters if defined for 
  4898.            the current locale. 
  4899.  
  4900.  + or (    Determines the representation of positive and negative currency 
  4901.            amounts.  Only one of these flags may be specified.  The locale's 
  4902.            equivalent of + and - are used if + is specified.  The locale's 
  4903.            equivalent of enclosing negative amounts within parentheses is used 
  4904.            if ( is specified.  If neither flag is included, a default specified 
  4905.            by the current locale is used. 
  4906.  
  4907.  !         Suppresses the currency symbol from the output conversion. 
  4908.  
  4909.  Field Width 
  4910.  
  4911.  w         The decimal-digit string, w, specifies the minimum field width in 
  4912.            which the result of the conversion is right-justified.  If -w is 
  4913.            specified, the result is left-justified. 
  4914.  
  4915.   Left Precision 
  4916.  
  4917.  #n        A # (pound sign) followed by a decimal-digit string, n, specifies 
  4918.            the maximum number of digits to be formatted to the left of the 
  4919.            radix character.  This option can be specified to keep formatted 
  4920.            output from multiple calls to the strfmon function aligned in the 
  4921.            same columns.  It can also be used to fill unused positions with a 
  4922.            special character (for example, $***123.45).  This option causes an 
  4923.            amount to be formatted as if it has the number of digits specified 
  4924.            by the n variable.  If more than n digit positions are required, 
  4925.            this option is ignored.  Digit positions in excess of those required 
  4926.            are filled with the numeric fill character set with the =f flag. 
  4927.  
  4928.            If defined for the current locale and not suppressed with the \^ 
  4929.            flag, grouping is applied to the fill characters and regular digits. 
  4930.            If the fill character is not 0, however, grouping separators 
  4931.            following a fill character  are replaced by the fill character (for 
  4932.            example, $0,001,234.56 and $****1,234.56). 
  4933.  
  4934.   Right Precision 
  4935.  
  4936.  .p        A .(period) followed by a decimal digit string, p, specifies the 
  4937.            number of digits after  the radix character.  If the value of the p 
  4938.            variable is 0, no radix character is used.  If a right precision is 
  4939.            not specified, a default specified by the current locale is use. 
  4940.            The amount being formatted is rounded to the specified number of 
  4941.            digits prior to formatting. 
  4942.  
  4943.   Conversion Characters 
  4944.  
  4945.  i         The double argument is formatted according to the current locale's 
  4946.            international  currency format; for example, in the U.S.: 1,234.56. 
  4947.  
  4948.  n         The double argument is formatted according to the current locale's 
  4949.            national  currency  format;  for  example,  in  the  U.S.: 
  4950.            $1,234.56. 
  4951.  
  4952.  %         No argument is converted; the conversion specification %% is 
  4953.            replaced by a single %. 
  4954.  
  4955.  
  4956.  Return Values 
  4957.  
  4958.  If successful, and if the number of resulting bytes (including the terminating 
  4959.  null character) is not more than the number of bytes specified by the maxsize 
  4960.  parameter, this function returns the number of bytes placed into the array 
  4961.  pointed to by the s parameter.  Otherwise, -1 is returned and the contents of 
  4962.  the s array are indeterminate. 
  4963.  
  4964.  
  4965.  Related Information 
  4966.  
  4967.      scanf 
  4968.      strftime 
  4969.      strptime 
  4970.      wcsftime 
  4971.      monetary.h 
  4972.  
  4973.  
  4974.  Example 
  4975.  
  4976.  This example sets the locale and prints out the monitary information with 
  4977.  respect to that locales specification. 
  4978.  
  4979.   #include <stdlib.h>
  4980.   #include <stdio.h>
  4981.   #include <wchar.h>
  4982.   #include <locale.h>
  4983.  
  4984.   int main (void) {
  4985.       char temp1[255], buffer[256];
  4986.       double num = 0.0;
  4987.       size_t rc;
  4988.  
  4989.       printf("Setlocal returns: %s \n", setlocale(LC_ALL, ""));
  4990.  
  4991.       num = 123456.789;
  4992.  
  4993.       rc = strfmon(temp1,sizeof(temp1),"Monetary %n",num);
  4994.  
  4995.       printf("strfmon rc = %ld\n",rc);
  4996.       printf("Monetary value is %.2f    %s\n",num,temp1);
  4997.  
  4998.       } /* end main */
  4999.  
  5000.  
  5001. ΓòÉΓòÉΓòÉ 11.2. strftime -- Formats time and date ΓòÉΓòÉΓòÉ
  5002.  
  5003.  
  5004. Syntax 
  5005.  
  5006. #include <wchar.h>
  5007.  
  5008. size_t strftime(char *String, size_t Maxsize, const char *Format,
  5009.             const struct tm *TmPtr);
  5010.  
  5011. Description 
  5012.  
  5013. The strftime function converts the internal time and date specification of the 
  5014. tm structure, which is pointed to by the TmPtr parameter, into a character 
  5015. string pointed to by the String parameter under the direction of the format 
  5016. string pointed to by the Format parameter.  The actual values for the format 
  5017. specifiers are dependent on the current settings for the  LC_TIME Category. 
  5018. The tm structure values may be assigned by the user or generated by the 
  5019. localtime or gmtime function.  The resulting string is similar to the result of 
  5020. the printf format parameter, and is placed in the memory location addressed by 
  5021. the String parameter.  The maximum length of the string is determined by the 
  5022. Maxsize parameter and terminates with a null character. 
  5023.  
  5024. Many conversion specifications are the same as those used by the date command. 
  5025. The interpretation of some conversion specifications is dependent on the 
  5026. current locale of the process.  The Format parameter is a character string 
  5027. containing two types of objects: plain characters that are simply placed in the 
  5028. output string, and conversion specifications that convert information from the 
  5029. TmPtr parameter into readable form in the output string.  Each conversion 
  5030. specification is a sequence of this form:  %[[-]width][.precision]type  A % 
  5031. (percent sign) introduces a conversion specification.  An optional 
  5032. decimal-digit string specifies a minimum field width.  A converted value that 
  5033. has fewer characters than the field width is padded with spaces to the left. 
  5034. If the decimal digit string is preceded by a - (minus sign), padding with 
  5035. spaces occurs to the right of the converted value.  If no width is given, the 
  5036. appropriate default width is used for numeric  fields, with the field padded to 
  5037. the left with zeros, as required.  For strings, the output  field  is  made 
  5038. exactly wide enough to contain the string.  An optional precision value gives 
  5039. the maximum number of characters to be printed for the conversion 
  5040. specification.  The precision value  is  a decimal-digit string preceded by a 
  5041. period.  If the  value  to be output is longer than the precision, the string 
  5042. is truncated on the right.  The type of conversion is specified by one or two 
  5043. conversion characters.  The characters and their meanings are: 
  5044.  
  5045.  %a        Represents the locale's abbreviated weekday name (for example,Sun). 
  5046.  
  5047.  %A        Represents the locale's full weekday name (for example, Sunday). 
  5048.  
  5049.  %b        Represents the locale's abbreviated month name (for example,Jan). 
  5050.  
  5051.  %B        Represents the locale's full month name (for example, January). 
  5052.  
  5053.  %c        Represents the locale's date and time format. 
  5054.  
  5055.  %C        Represents the century. 
  5056.  
  5057.  %d        Represents the day of the month as a decimal number (01 to 31). 
  5058.  
  5059.  %D        Represents the date in %m/%d/%y format (for example, 01/31/91). 
  5060.  
  5061.  %e        Represents the day of the month as a decimal number ( 1 to 31). An 
  5062.            single digit is preceded by a space character. 
  5063.  
  5064.  %h        Same as %b. 
  5065.  
  5066.  %H        Represents the 24-hour-clock hour as a decimal number (00 to 23). 
  5067.  
  5068.  %I        Represents the 12-hour-clock hour as a decimal number (01 to 12). 
  5069.  
  5070.  %j        Represents the day of the year as a decimal number (001 to 366). 
  5071.  
  5072.  %m        Represents the month of the year as a decimal number (01 to 12). 
  5073.  
  5074.  %M        Represents the minute of the hour as a decimal number (00 to 59). 
  5075.  
  5076.  %n        Specifies a new-line character. 
  5077.  
  5078.  %p        Represents the locale's AM or PM string. 
  5079.  
  5080.  %r        Represents 12-hour clock time with AM/PM notation(%I:%M:0p). 
  5081.  
  5082.  %R        Represents 24-hour-clock time in the format %H:%M. 
  5083.  
  5084.  %S        Represents the second of the minute as a decimal number (00 to 61). 
  5085.  
  5086.  %t        Specifies a tab character. 
  5087.  
  5088.  %T        Represents 24-hour-clock time in the format %H:%M:%S. 
  5089.  
  5090.  %u        Represents the day of the week as a decimal number (1 to 7). Monday 
  5091.            is considered as 1. 
  5092.  
  5093.  %U        Represents the week of the year as a decimal number (00 to 53). 
  5094.            Sunday is considered the first day of the week. 
  5095.  
  5096.  %V        Represents the week of the year as a decimal number (01 to 53). 
  5097.            Monday is considered the first day of the week.  If the week 
  5098.            containing 1 January has four or more days in the new year, then it 
  5099.            is considered week 1; otherwise, it is week 53 of the previous year, 
  5100.            and the next week is week 1. 
  5101.  
  5102.  %w        Represents the day of the week as a decimal number (0 to 6). Sunday 
  5103.            is considered as 0. 
  5104.  
  5105.  %W        Represents the week of the year as a decimal number (00 to 53). 
  5106.            Monday is considered the first day of the week. All days in a new 
  5107.            year preceding the first Monday are considered to be week 0. 
  5108.  
  5109.  %x        Represents the locale's date format. 
  5110.  
  5111.  %X        Represents the locale's time format. 
  5112.  
  5113.  %y        Represents the year of the century (00 to 99). 
  5114.  
  5115.  %Y        Represents the year with century as a decimal number (1989). 
  5116.  
  5117.  %Z        Represents the time-zone name if one can be determined (for example, 
  5118.            EST).  No characters are displayed if a time zone cannot be 
  5119.            determined. 
  5120.  
  5121.  %%        Specifies a % (percent) sign. 
  5122.  
  5123.  
  5124.  Parameters 
  5125.  
  5126.  String    Pointer to the string to hold the formatted time. 
  5127.  
  5128.  Maxsize   Maximum length of string pointed to by the String parameter. 
  5129.  
  5130.  Format    Pointer to the format character string. 
  5131.  
  5132.  TmPtr     Pointer to the time structure that is to be converted. 
  5133.  
  5134.  
  5135.  Return Values 
  5136.  
  5137.  If the total number of resulting bytes, including the terminating null byte, 
  5138.  is not more than the Maxsize value, the strftime function returns the number 
  5139.  of bytes placed into the array pointed to by the String parameter.  Otherwise, 
  5140.  0 is returned and the contents of the array are indeterminate. 
  5141.  
  5142.  
  5143.  Related Information 
  5144.  
  5145.      strfmon 
  5146.      strptime 
  5147.      mbstowcs 
  5148.      wcsftime 
  5149.      localtime 
  5150.      gmtime 
  5151.      printf 
  5152.  
  5153.  
  5154.  Example 
  5155.  
  5156.  This code fragment sets the locale and calls strftime to print out the time 
  5157.  with respect to that locales format. 
  5158.  
  5159.   #include <stdlib.h>
  5160.   #include <stdio.h>
  5161.   #include <time.h>
  5162.   #include <wchar.h>
  5163.   #include <locale.h>
  5164.  
  5165.   int main (void) {
  5166.       char temp[255];
  5167.       time_t ltime;
  5168.       size_t rc;
  5169.       struct tm *ptmTemp;
  5170.  
  5171.       printf("\nCalling setlocale\n");
  5172.       printf("Setlocale returns: %s \n", setlocale(LC_ALL, ""));
  5173.  
  5174.       time(<ime);
  5175.  
  5176.       ptmTemp = localtime(<ime);
  5177.  
  5178.       rc = strftime(temp,sizeof(temp),"At   Time %9X   Date %9x %a %A %b %B %h",ptmTemp);
  5179.  
  5180.       printf("strftime rc = %ld\n",rc);
  5181.       printf("%s\n",temp);
  5182.       }
  5183.  
  5184.  
  5185. ΓòÉΓòÉΓòÉ 11.3. strptime -- Converts a character string to a time value ΓòÉΓòÉΓòÉ
  5186.  
  5187.  
  5188. Syntax 
  5189.  
  5190. #include <time.h>
  5191.  
  5192. char *strptime(const char *String, const char *Format, struct tm *TmPtr);
  5193.  
  5194. Description 
  5195.  
  5196. The strptime function converts the characters in the String parameter to values 
  5197. that are stored in TmPtr, using the format specified by the Format parameter. 
  5198.  
  5199.  
  5200. Parameters 
  5201.  
  5202.  String    Contains the character string to be converted. 
  5203.  
  5204.  Format    Contains format specifiers for the strptime function. 
  5205.  
  5206.  TmPtr     Specifies the structure to contain the output of the strptime 
  5207.            function.  If a conversion fails, the contents of the TmPtr 
  5208.            structure are undefined. 
  5209.  
  5210.  Format Specifiers 
  5211.  
  5212.  The Format parameter contains zero or more specifiers.  Each specifier is 
  5213.  composed of one of the following: 
  5214.  
  5215.      One or more white-space characters 
  5216.      An ordinary character (neither % nor a white-space character) 
  5217.      A format specifier. 
  5218.  
  5219.  The  LC_TIME category defines the locale values for the format specifiers. 
  5220.  The following format specifiers are supported: 
  5221.  
  5222.  %a        Represents the weekday name; abbreviated or full (for example, Sun 
  5223.            or Sunday) defined for the locale. 
  5224.  
  5225.  %A        Same as %a. 
  5226.  
  5227.  %b        Represents the month name ; abbreviated or full (for example, Jan or 
  5228.            January) defined for the locale. 
  5229.  
  5230.  %B        Same as %b. 
  5231.  
  5232.  %c        Represents the date and time format defined by the locale(%x %X). 
  5233.  
  5234.  %C        Represents the century number (0,99). 
  5235.  
  5236.  %d        Represents the day of the month as a decimal number (1 to 31). 
  5237.  
  5238.  %D        Represents the date in %m/%d/%y format (for example, 12/31/93). 
  5239.  
  5240.  %e        Same as %d. 
  5241.  
  5242.  %h        Same as %b. 
  5243.  
  5244.  %H        Represents the 24-hour-clock hour as a decimal number (00 to 23). 
  5245.  
  5246.  %I        Represents the 12-hour-clock hour as a decimal number (01 to 12). 
  5247.  
  5248.  %j        Represents the day of the year as a decimal number (001 to 366). 
  5249.  
  5250.  %m        Represents the month as a decimal number (01 to 12). 
  5251.  
  5252.  %M        Represents the minutes of the hour as a decimal number (00 to 59). 
  5253.  
  5254.  %n        Specifies any white space. 
  5255.  
  5256.  %p        Represents the AM or PM string defined by the am_pm statement. 
  5257.  
  5258.  %r        Represents the time in the format %I:%M:0p. 
  5259.  
  5260.  %R        Represents the time in the format %H:%M (for example, 16:5). 
  5261.  
  5262.  %S        Represents the seconds (00 to 61). 
  5263.  
  5264.  %t        Specifies any white space. 
  5265.  
  5266.  %T        Represents 24-hour-clock time in the format %H:%M:%S. 
  5267.  
  5268.  %U        Represents the week of the year as a decimal number (00 to 53). 
  5269.            Sunday is considered the first day of the week. 
  5270.  
  5271.  %w        Represents the day of the week as a decimal number (0 to 6). Sunday 
  5272.            is considered as 0. 
  5273.  
  5274.  %W        Represents the week of the year as a decimal number (00 to 53). 
  5275.            Monday is considered the first day of the week. 
  5276.  
  5277.  %x        Represents the date, defined by the locale's date format. 
  5278.  
  5279.  %X        Represents the time, defined by the locale's time format. 
  5280.  
  5281.  %y        Represents the year of the century (00 to 99). 
  5282.  
  5283.  %Y        Represents the year including the century (for example, 1939). 
  5284.  
  5285.  %%        Specifies a % (percent sign) character. 
  5286.  
  5287.  A format specification consisting of white-space characters is performed  by 
  5288.  reading input until the first non-white-space character (which  is  not  read) 
  5289.  or up to no more characters can be read. 
  5290.  
  5291.  A format specification consisting of an ordinary character is performed by 
  5292.  reading the next character from the String parameter. If  this  character 
  5293.  differs  from  the character comprising  the directive,  the  directive  fails 
  5294.  and the differing character and any characters following  it remain unread. 
  5295.  Case is ignored when matching String items, such as month or weekday names. 
  5296.  
  5297.  
  5298.  Return Values 
  5299.  
  5300.  If successful, the strptime function returns a pointer to the character 
  5301.  following the last character parsed.  Otherwise, a null pointer is returned. 
  5302.  
  5303.  
  5304.  Related Information 
  5305.  
  5306.      scanf 
  5307.      strfmon 
  5308.      strftime 
  5309.      wcsftime 
  5310.  
  5311.  
  5312.  Example 
  5313.  
  5314.  This example loads the locale and sets the day of the week and the date in the 
  5315.  time structure to 10/21/93 and prints out the results with respect to the 
  5316.  locale loaded. 
  5317.  
  5318.   #include <stdlib.h>
  5319.   #include <stdio.h>
  5320.   #include <time.h>
  5321.  
  5322.   #include <wchar.h>
  5323.   #include <locale.h>
  5324.  
  5325.   int main (void) {
  5326.       char temp[255];
  5327.       const char *buf;
  5328.       time_t ltime;
  5329.       char rc;
  5330.       char *rcp;
  5331.       struct tm *ptmTemp;
  5332.  
  5333.       ptmTemp = malloc(sizeof(*ptmTemp));
  5334.  
  5335.       strcpy(temp,"12:34:56 10/21/93");
  5336.  
  5337.       printf("\nCalling setlocale\n");
  5338.       printf("Setlocale returns: %s \n", setlocale(LC_ALL, ""));
  5339.  
  5340.       rcp = strptime(temp, "%T %D", ptmTemp);
  5341.  
  5342.       if(rcp != NULL) {
  5343.         rc = strftime(temp,sizeof(temp),"At   Time %9X   Date %9x %A %B %r",ptmTemp);
  5344.         printf("%s\n",temp);
  5345.         return(1);
  5346.         }
  5347.  
  5348.       return (0);
  5349.       }
  5350.  
  5351.  
  5352. ΓòÉΓòÉΓòÉ 11.4. wcsftime -- Converts date and time into a wide-character string ΓòÉΓòÉΓòÉ
  5353.  
  5354.  
  5355. Syntax 
  5356.  
  5357. #include <wchar.h>
  5358.  
  5359. size_t wcsftime(wchar_t *WcString, size_t Maxsize, const char *Format,
  5360.             const struct tm *TmPtr);
  5361.  
  5362. Description 
  5363.  
  5364. The wcsftime function formats the data in the TmPtr parameter according to the 
  5365. specification contained in the Format parameter and places the resulting 
  5366. wide-character string into the WcString parameter.  Up to Maxsize-1 
  5367. wide-characters are placed into the WcString parameter, terminated by a 
  5368. wide-character NULL.  The wcsftime function behaves as if the character string 
  5369. generated by the strftime function is passed to the mbstowcs function as the 
  5370. character string parameter and the mbstowcs function places the result in the 
  5371. WcString parameter of the wcsftime function, up to the limit of wide-character 
  5372. codes specified by the Maxsize parameter. 
  5373.  
  5374.  
  5375. Parameters 
  5376.  
  5377.  WcString  Contains the output of the wcsftime function. 
  5378.  
  5379.  Maxsize   Specifies the maximum number of bytes (including the wide character 
  5380.            null-terminating byte) that may be placed in the WcString parameter. 
  5381.  
  5382.  Format    Contains format specifiers.  The  LC_TIME category defines the 
  5383.            locale values for the format specifiers.  The Format parameter can 
  5384.            use the same format specifiers as strftime. 
  5385.  
  5386.  TmPtr     Contains the data to be converted by the wcsftime function. 
  5387.  
  5388.  
  5389.  Return Values 
  5390.  
  5391.  If successful, and if the number of resulting wide-characters (including  the 
  5392.  wide-character null-terminating byte) is no more than the number of bytes 
  5393.  specified by the Maxsize parameter, the wcsftime function returns the number 
  5394.  of wide-characters (not including the wide-character null-terminating byte) 
  5395.  placed in the WcString parameter.  Otherwise, 0 (zero) is returned and the 
  5396.  contents of the WcString parameter are indeterminate. 
  5397.  
  5398.  
  5399.  Related Information 
  5400.  
  5401.      strfmon 
  5402.      strftime 
  5403.      strptime 
  5404.      mbstowcs 
  5405.  
  5406.  
  5407.  Example 
  5408.  
  5409.  This example sets the locale and calls wcsftime to print out the time in 
  5410.  wide-character with respect to that locales format. 
  5411.  
  5412.   #include <stdlib.h>
  5413.   #include <stdio.h>
  5414.   #include <time.h>
  5415.   #include <wchar.h>
  5416.   #include <locale.h>
  5417.  
  5418.   int main (void) {
  5419.       wchar_t temp[255];
  5420.       time_t ltime;
  5421.       size_t rc;
  5422.       struct tm *ptmTemp;
  5423.  
  5424.       printf("\nCalling setlocale\n");
  5425.       printf("Setlocale returns: %s \n", setlocale(LC_ALL, ""));
  5426.  
  5427.       time(<ime);
  5428.       ptmTemp = localtime(<ime);
  5429.  
  5430.       rc=wcsftime(temp,sizeof(temp),"At   Time %9X   Date %9x %a %A %b %B %h",ptmTemp);
  5431.  
  5432.       printf("wcsftime rc = %ld\n",rc);
  5433.       printf("%ls\n",temp);
  5434.       }
  5435.  
  5436.  
  5437. ΓòÉΓòÉΓòÉ 12. WideChar String Functions ΓòÉΓòÉΓòÉ
  5438.  
  5439. Basic String manipulation API for wchar_t data type: 
  5440.  
  5441.  
  5442.     wchar_t *wcscat  (wchar_t       *string1, const wchar_t *string2);
  5443.     wchar_t *wcschr  (wchar_t       *string1, wint_t         wc);
  5444.     int      wcscmp  (const wchar_t *string1, const wchar_t *string2);
  5445.     wchar_t *wcscpy  (wchar_t       *string1, const wchar_t *string2);
  5446.     size_t   wcscspn (const wchar_t *string1, const wchar_t *string2);
  5447.     size_t   wcslen  (const wchar_t *ws);
  5448.     wchar_t *wcsncat (wchar_t       *string1, const wchar_t *string2, size_t n);
  5449.     int      wcsncmp (const wchar_t *string1, const wchar_t *string2, size_t n);
  5450.     wchar_t *wcsncpy (wchar_t       *string1, const wchar_t *string2, size_t n);
  5451.     wchar_t *wcspbrk (const wchar_t *string1, const wchar_t *string2);
  5452.     wchar_t *wcsrchr (wchar_t       *string1, wint_t         wc);
  5453.     size_t   wcsspn  (const wchar_t *string1, const wchar_t *string2);
  5454.     wchar_t *wcstok  (wchar_t       *string1, const wchar_t *string2);
  5455.     wchar_t *wcswcs  (const wchar_t *string1, const wchar_t *string2);
  5456.     int      wcswidth(wchar_t *ws, size_t n);
  5457.     char     wctype(const char *charclass);
  5458.     int      wcwidth(wchar_t wc);
  5459.  
  5460.  
  5461. ΓòÉΓòÉΓòÉ 12.1. wcscat -- Append strings ΓòÉΓòÉΓòÉ
  5462.  
  5463.  
  5464. Syntax 
  5465.  
  5466. #include <wchar.h>
  5467. wchar_t *wcscat(wchar_t *string1, const wchar_t *string2);
  5468.  
  5469.  
  5470. Description. 
  5471.  
  5472. The wcscat function appends a copy of the string pointed to by string2 to the 
  5473. end of the string pointed to by string1. 
  5474.  
  5475. This function operates on null-terminated wchar_t strings. The string arguments 
  5476. to this function should contain a wchar_t null character marking the end of the 
  5477. string. Boundary checking is not performed. 
  5478.  
  5479.  
  5480. Return Values 
  5481.  
  5482. This function returns the value of string1. 
  5483.  
  5484.  
  5485. Related Information 
  5486.  
  5487.      strcat  - Concatenate Strings 
  5488.      strncat - Concatenate Strings 
  5489.      wcsncat - Concatenate wchar_t Strings 
  5490.      wchar.h 
  5491.  
  5492.  
  5493.  Example 
  5494.  
  5495.  This example creates the wide-character string "computer program". 
  5496.  
  5497.   #include <stdio.h>
  5498.   #include <wchar.h>
  5499.  
  5500.   int main(void) {
  5501.       wchar_t buffer1[40];
  5502.       wchar_t string[40];
  5503.       wchar_t * ptr;
  5504.  
  5505.       mbstowcs(buffer1,"computer",9);
  5506.       mbstowcs(string," program",9);
  5507.  
  5508.       ptr = wcscat( buffer1, string );
  5509.  
  5510.       printf( "buffer1 = %S\n", buffer1 );
  5511.       }
  5512.   /****************  Output should be similar to:  ******************
  5513.  
  5514.   buffer1 = computer program
  5515.  
  5516.   *******************************************************************/
  5517.  
  5518.  
  5519. ΓòÉΓòÉΓòÉ 12.2. wcschr -- Search string for wide-character ΓòÉΓòÉΓòÉ
  5520.  
  5521.  
  5522. Syntax 
  5523.  
  5524. #include <wchar.h>
  5525.  
  5526. wchar_t  *wcschr(const wchar_t *string1, wint_t wc);
  5527.  
  5528.  
  5529. Description. 
  5530.  
  5531. The wcschr function searches string1 for the occurrence of wc. wc may be a 
  5532. wint_t null character (L0). The wchar_t null character at the end of string1 is 
  5533. included in the search. 
  5534.  
  5535. This function operates on null-terminated wchar_t strings. The string1 argument 
  5536. to this function should contain a wchar_t null character marking the end of the 
  5537. string. 
  5538.  
  5539.  
  5540. Return Values 
  5541.  
  5542. This function returns a pointer to the first occurrence of wc in string1. If 
  5543. the character is not found, a NULL pointer is returned. 
  5544.  
  5545.  
  5546. Related Information 
  5547.  
  5548.      wcscspn - Find Offset of First wchar_t Match 
  5549.      wcspbrk - Locate wchar_t Characters in wchar_t String 
  5550.      wcsrchr - Locate wchar_t Character in wchar_t String 
  5551.      wcsspn  - Search wchar_t Characters in wchar_t String 
  5552.      wcswcs  - Locate wchar_t Substring in wchar_t String 
  5553.      wchar.h 
  5554.  
  5555.  
  5556.  Example 
  5557.  
  5558.  This example finds the first occurrence of the character p in the wide 
  5559.  character string "computer program". 
  5560.  
  5561.   #include <stdio.h>
  5562.   #include <wchar.h>
  5563.  
  5564.   int main(void) {
  5565.       wchar_t buffer1[20];
  5566.       wchar_t * ptr;
  5567.       wchar_t wc = (wchar_t)'p';
  5568.  
  5569.       mbstowcs(buffer1,"computer program",17);
  5570.  
  5571.       ptr = wcschr( buffer1, wc );
  5572.  
  5573.       printf( "The first occurrence of %C in '%S' is '%S'\n",
  5574.                          wc, buffer1, ptr );
  5575.  
  5576.       }
  5577.   /****************  Output should be similar to:  ******************
  5578.  
  5579.   The first occurrence of p in 'computer program' is 'puter program'
  5580.  
  5581.   *******************************************************************/
  5582.  
  5583.  
  5584. ΓòÉΓòÉΓòÉ 12.3. wcscmp -- Compare strings ΓòÉΓòÉΓòÉ
  5585.  
  5586.  
  5587. Syntax 
  5588.  
  5589. #include <wchar.h>
  5590.  
  5591. int wcscmp(const wchar_t *string1, const wchar_t *string2);
  5592.  
  5593.  
  5594. Description. 
  5595.  
  5596. The wcscmp function compares two wchar_t strings. 
  5597.  
  5598. This function operates on null-terminated wchar_t strings. The string arguments 
  5599. to this function should contain a wchar_t null character marking the end of the 
  5600. string. Boundary checking is not performed when a string is added to or copied. 
  5601.  
  5602.  
  5603. Return Values 
  5604.  
  5605. The wcscmp function returns a value indicating the relationship between the two 
  5606. strings, as follows: 
  5607.  
  5608.  Value             Meaning 
  5609.  
  5610.  Less than 0       string1 less than string2 
  5611.  0                 string1 identical to string2 
  5612.  Greater than 0    string1 greater than string2. 
  5613.  
  5614.  
  5615.  Related Information 
  5616.  
  5617.      wcsncmp  - Compare wchar_t Strings 
  5618.      wchar.h 
  5619.  
  5620.  
  5621.  Example 
  5622.  
  5623.  This example compares the wide-character string string1 to string2 
  5624.  
  5625.   #include <stdio.h>
  5626.   #include <wchar.h>
  5627.  
  5628.   int main(void) {
  5629.       int  result;
  5630.       wchar_t string1[20];
  5631.       wchar_t string2[20];
  5632.  
  5633.       mbstowcs(string1,"abcdef",7);
  5634.       mbstowcs(string2,"abcdefg",8);
  5635.  
  5636.       result=wcscmp( string1, string2 );
  5637.  
  5638.       if ( result == 0 )
  5639.         printf( "\"%S\" is identical to \"%S\"\n", string1, string2);
  5640.       else if ( result < 0 )
  5641.         printf( "\"%S\" is less than \"%S\"\n", string1, string2 );
  5642.       else
  5643.         printf( "\"%S\" is greater than \"%S\"\n", string1, string2);
  5644.       }
  5645.   /****************  Output should be similar to:  ******************
  5646.  
  5647.   "abcdef" is less than "abcdefg"
  5648.  
  5649.   *******************************************************************/
  5650.  
  5651.  
  5652. ΓòÉΓòÉΓòÉ 12.4. wcscpy -- Copy a string ΓòÉΓòÉΓòÉ
  5653.  
  5654.  
  5655. Syntax 
  5656.  
  5657. #include <wchar.h>
  5658.  
  5659. wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);
  5660.  
  5661.  
  5662. Description. 
  5663.  
  5664. The wcscpy function copies the contents of string2 (including the ending 
  5665. wchar_t null character) into string1. 
  5666.  
  5667. This function operates on null-terminated wchar_t strings. The string arguments 
  5668. to this function should contain a wchar_t null character marking the end of the 
  5669. string.  Boundary checking is not performed. 
  5670.  
  5671.  
  5672. Return Values 
  5673.  
  5674. The wcscpy function returns the value of string1. 
  5675.  
  5676.  
  5677. Related Information 
  5678.  
  5679.      wcsncpy  - Copy wchar_t Strings 
  5680.      wchar.h 
  5681.  
  5682.  
  5683.  Example 
  5684.  
  5685.  This example copies the contents of a source string to a destination string. 
  5686.  
  5687.   #include <stdio.h>
  5688.   #include <wchar.h>
  5689.  
  5690.   int main(void) {
  5691.       wchar_t source[ 80 ];
  5692.       wchar_t target[ 80 ];
  5693.       wchar_t *wsptr;
  5694.  
  5695.       mbstowcs(string1,"This is the source string",40);
  5696.       mbstowcs(string1,"And this is the target string",40);
  5697.  
  5698.       printf( "Target is originally = \"%S\"\n", target );
  5699.  
  5700.       wsptr = wcscpy( target, source );
  5701.  
  5702.       printf( "After wcscpy, target becomes \"%S\"\n", wsptr );
  5703.       }
  5704.   /****************  Output should be similar to:  ******************
  5705.  
  5706.   Target is originally = "And this is the target string"
  5707.   After wcscpy, target becomes "This is the source string"
  5708.  
  5709.   *******************************************************************/
  5710.  
  5711.  
  5712. ΓòÉΓòÉΓòÉ 12.5. wcscspn -- Find length of complementary wide char substring ΓòÉΓòÉΓòÉ
  5713.  
  5714.  
  5715. Syntax 
  5716.  
  5717. #include <wchar.h> /* SAA extension to ANSI */
  5718.  
  5719. size_t wcscspn(const wchar_t *string1, const wchar_t *string2);
  5720.  
  5721.  
  5722. Description. 
  5723.  
  5724. The wcscspn function finds the first occurrence of a wchar_t character in the 
  5725. string pointed to by string1 that belongs to the set of wchar_t characters 
  5726. specified by the string pointed to by string2. 
  5727.  
  5728. This function operates on null-terminated wchar_t strings. The string arguments 
  5729. to these functions should contain a wchar_t null character marking the end of 
  5730. the string. 
  5731.  
  5732.  
  5733. Return Values 
  5734.  
  5735. The wcscspn function returns the index of the first character found.  This 
  5736. value is equivalent to the length of the initial substring of string1 that 
  5737. consists entirely of characters not in string2. 
  5738.  
  5739.  
  5740. Related Information 
  5741.  
  5742.      wcsspn  - Search wchar_t Characters in String 
  5743.      wcswcs  - Locate wchar_t Substring in wchar_t String 
  5744.      wchar.h 
  5745.  
  5746.  
  5747.  Example 
  5748.  
  5749.  This example uses wcscspn to find the first occurrence of any of the 
  5750.  characters a, x, l, or e in the string "This is the source string". 
  5751.  
  5752.   #include <stdio.h>
  5753.   #include <wchar.h>
  5754.  
  5755.   int main(void) {
  5756.       wchar_t ws[ 80 ];
  5757.       wchar_t * substring[ 10 ];
  5758.  
  5759.       mbstowcs(ws,"This is the source string",40);
  5760.       mbstowcs(substring,"axle",10);
  5761.  
  5762.       printf( "The first %i characters in the string \"%S\" are not "
  5763.          "in the string \"%S\" \n", wcscspn( ws, substring),
  5764.          ws, substring );
  5765.  
  5766.       }
  5767.  
  5768.  
  5769.   /****************  Output should be similar to:  ************************
  5770.  
  5771.   The first 10 characters in the string "This is the source string" are not
  5772.   in the string "axle"
  5773.  
  5774.   *************************************************************************/
  5775.  
  5776.  
  5777. ΓòÉΓòÉΓòÉ 12.6. wcslen -- Find length of wide-character string ΓòÉΓòÉΓòÉ
  5778.  
  5779.  
  5780. Syntax 
  5781.  
  5782. #include <wchar.h>
  5783.  
  5784. size_t wcslen(const wchar_t *ws);
  5785.  
  5786.  
  5787. Description. 
  5788.  
  5789. The wcslen function computes the number of wchar_t characters in the string 
  5790. pointed to by ws. 
  5791.  
  5792.  
  5793. Return Values 
  5794.  
  5795. The wcslen function returns the number of wchar_t characters that precede the 
  5796. terminating wchar_t null character. 
  5797.  
  5798.  
  5799. Related Information 
  5800.  
  5801.      mblen  - Multibyte String Length 
  5802.      strlen - Determine String Length 
  5803.      wchar.h 
  5804.  
  5805.  
  5806.  Example 
  5807.  
  5808.  This example computes the length of a wchar_t string. 
  5809.  
  5810.   #include <stdio.h>
  5811.   #include <wchar.h>
  5812.  
  5813.   int main(void) {
  5814.       wchar_t  ws[ 20 ];
  5815.  
  5816.       mbstowcs(ws,"abcdef",7);
  5817.       printf( "Length of \"%S\" is %i\n", ws, wcslen( ws ));
  5818.  
  5819.       }
  5820.   /****************  Output should be similar to:  ******************
  5821.  
  5822.   Length of "abcdef" is 6
  5823.  
  5824.   *******************************************************************/
  5825.  
  5826.  
  5827. ΓòÉΓòÉΓòÉ 12.7. wcsncat -- Append strings ΓòÉΓòÉΓòÉ
  5828.  
  5829.  
  5830. Syntax 
  5831.  
  5832. #include <wchar.h>
  5833.  
  5834. wchar_t *wcsncat(wchar_t *string1, const wchar_t *string2, size_t count);
  5835.  
  5836.  
  5837. Description. 
  5838.  
  5839. The wcsncat function appends up to count wide-characters from string2 to the 
  5840. end of string1 and appends a wchar_t null character to the result. 
  5841.  
  5842. This function operates on null-terminated wchar_t strings. The string arguments 
  5843. to this function should contain a wchar_t null character marking the end of the 
  5844. string. 
  5845.  
  5846.  
  5847. Return Values 
  5848.  
  5849. The wcsncat function returns string1. 
  5850.  
  5851.  
  5852. Related Information 
  5853.  
  5854.      strncat - Concatenate Strings 
  5855.      strcat  - Concatenate Strings 
  5856.      wcscat  - Append wchar_t Strings 
  5857.      wchar.h 
  5858.  
  5859.  
  5860.  Example 
  5861.  
  5862.  This example demonstrates the difference between wcscat and wcsncat. Wcscat 
  5863.  appends the entire second string to the first whereas wcsncat appends only the 
  5864.  specified number of characters in the second string to the first. 
  5865.  
  5866.   #include <stdio.h>
  5867.   #include <wchar.h>
  5868.  
  5869.   int main(void) {
  5870.       wchar_t * buffer1;
  5871.       wchar_t * buffer2;
  5872.       wchar_t * ptr;
  5873.  
  5874.       buffer1 = (wchar_t *)malloc(80);
  5875.       buffer2 = (wchar_t *)malloc(20);
  5876.  
  5877.       mbstowcs(buffer1,"computer",9);
  5878.       mbstowcs(buffer2," program",9);
  5879.  
  5880.       /* Call wcscat with buffer1 and " program" */
  5881.  
  5882.       ptr = wcscat( buffer1, buffer2 );
  5883.       printf( "wcscat : buffer1 = \"%S\"\n", buffer1 );
  5884.  
  5885.       /* Reset buffer1 to contain just the string "computer" again */
  5886.  
  5887.       memset( buffer1, '\0', sizeof( buffer1 ));
  5888.       mbstowcs(buffer1,"computer",9);
  5889.  
  5890.       /* Call wcsncat with buffer1 and " program" */
  5891.       ptr = wcsncat( buffer1, buffer2, 3 );
  5892.  
  5893.       printf( "wcsncat: buffer1 = \"%S\"\n", buffer1 );
  5894.       }
  5895.   /****************  Output should be similar to:  ******************
  5896.  
  5897.   wcscat : buffer1 = "computer program"
  5898.   wcsncat: buffer1 = "computer pr"
  5899.  
  5900.   *******************************************************************/
  5901.  
  5902.  
  5903. ΓòÉΓòÉΓòÉ 12.8. wcsncmp -- Compares subset string2 to string1 ΓòÉΓòÉΓòÉ
  5904.  
  5905.  
  5906. Syntax 
  5907.  
  5908. #include <wchar.h>
  5909.  
  5910. int wcsncmp(const wchar_t *string1, const wchar_t *string2, size_t count);
  5911.  
  5912.  
  5913. Description. 
  5914.  
  5915. The wcsncmp function compares up to count wide-characters in string1 to 
  5916. string2. 
  5917.  
  5918. The wcsncmp function operates on null-terminated wchar_t strings. The string 
  5919. arguments to this function should contain a wchar_t null character marking the 
  5920. end of the string. 
  5921.  
  5922. The wcsncmp function returns a value indicating the relationship between the 
  5923. two strings, as follows: 
  5924.  
  5925.  Value             Meaning 
  5926.  
  5927.  Less than 0       string1 less than string2 
  5928.  
  5929.  0                 string1 equivalent to string2 
  5930.  
  5931.  Greater than 0    string1 greater than string2 
  5932.  
  5933.  
  5934.  Related Information 
  5935.  
  5936.      wcscmp  - Compare wchar_t Strings 
  5937.      strcoll - Compare wchar_t Strings 
  5938.      wchar.h 
  5939.  
  5940.  
  5941.  Example 
  5942.  
  5943.  This example demonstrates the difference between wcscmp and wcsncmp. 
  5944.  
  5945.   #include <stdio.h>
  5946.   #include <wchar.h>
  5947.  
  5948.   int main(void) {
  5949.       int  result;
  5950.       wchar_t buffer1[20];
  5951.       wchar_t buffer2[20];
  5952.  
  5953.       mbstowcs(buffer1,"abcdefg",8);
  5954.       mbstowcs(buffer2,"abcfg",6);
  5955.  
  5956.       result = wcscmp( buffer1, buffer2 );
  5957.  
  5958.       printf( "Comparison of each character\n" );
  5959.       printf( "  wcscmp: " );
  5960.  
  5961.       if ( result == 0 )
  5962.         printf( "\"%S\" is identical to \"%S\"\n", buffer1, buffer2);
  5963.       else if ( result < 0 )
  5964.         printf( "\"%S\" is less than \"%S\"\n", buffer1, buffer2 );
  5965.       else
  5966.         printf( "\"%S\" is greater than \"%S\"\n", buffer1, buffer2 );
  5967.  
  5968.       result = wcsncmp( buffer1, buffer2, 3);
  5969.  
  5970.       printf( "\nComparison of only the first 3 characters\n" );
  5971.       printf( "  wcsncmp: " );
  5972.  
  5973.       if ( result == 0 )
  5974.         printf( "\"%S\" is identical to \"%S\"\n", buffer1, buffer2);
  5975.       else if ( result < 0 )
  5976.         printf( "\"%S\" is less than \"%S\"\n", buffer1, buffer2 );
  5977.       else
  5978.         printf( "\"%S\" is greater than \"%S\"\n", buffer1, buffer2 );
  5979.  
  5980.       }
  5981.   /****************  Output should be similar to:  ******************
  5982.  
  5983.   Comparison of each character
  5984.   wcscmp: "abcdefg" is less than "abcfg"
  5985.  
  5986.   Comparison of only the first 3 characters
  5987.   wcsncmp: "abcdefg" is identical to "abcfg"
  5988.  
  5989.   *******************************************************************/
  5990.  
  5991.  
  5992. ΓòÉΓòÉΓòÉ 12.9. wcsncpy -- Copy n wide-characters from string2 to string1 ΓòÉΓòÉΓòÉ
  5993.  
  5994.  
  5995. Syntax 
  5996.  
  5997. #include <wchar.h>
  5998.  
  5999. wchar_t *wcsncpy(wchar_t *string1, const wchar_t *string2, size_t count);
  6000.  
  6001.  
  6002. Description. 
  6003.  
  6004. The wcsncpy function copies up to count wide-characters from string2 to 
  6005. string1. If string2 is shorter than count characters, string1 is padded out to 
  6006. count characters with wchar_t null characters. 
  6007.  
  6008. This function operates on null-terminated wchar_t strings. The string arguments 
  6009. to this function should contain a wchar_t null character marking the end of the 
  6010. string. 
  6011.  
  6012.  
  6013. Return Values 
  6014.  
  6015. The wcsncpy function returns string1. 
  6016.  
  6017.  
  6018. Related Information 
  6019.  
  6020.      wcscpy  - Copy wchar_t Strings 
  6021.      wchar.h 
  6022.  
  6023.  
  6024.  Example 
  6025.  
  6026.  This example demonstrates the difference between wcscpy and wcsncpy. 
  6027.  
  6028.   #include <stdio.h>
  6029.   #include <wchar.h>
  6030.  
  6031.   int main(void) {
  6032.       wchar_t source[ 20 ];
  6033.       wchar_t source1[ 20 ];
  6034.       wchar_t target[ 20 ];
  6035.       wchar_t target1[ 20 ];
  6036.       wchar_t * return_string;
  6037.       int    index = 5;
  6038.  
  6039.       mbstowcs(source,"123456789",10);
  6040.       mbstowcs(source1,"123456789",10);
  6041.       mbstowcs(target,"abcdefg",8);
  6042.       mbstowcs(target1,"abcdefg",8);
  6043.  
  6044.       printf( "target is originally = '%S'\n", target );
  6045.  
  6046.       return_string = wcscpy( target, source );
  6047.  
  6048.       printf( "After wcscpy, target becomes '%S'\n\n", target );
  6049.  
  6050.       printf( "target is originally = '%S'\n", target1 );
  6051.  
  6052.       return_string = wcsncpy( target1, source1, index );
  6053.  
  6054.       printf( "After wcsncpy 'n=5', target becomes '%S'\n", target1 );
  6055.  
  6056.       }
  6057.   /****************  Output should be similar to:  ******************
  6058.  
  6059.   target is originally = 'abcdefg'
  6060.   After wcscpy 'n=5', target becomes '123456789'
  6061.  
  6062.   target1 is originally = 'abcdefg'
  6063.   After wcsncpy, target1 becomes '12345fg'
  6064.  
  6065.   *******************************************************************/
  6066.  
  6067.  
  6068. ΓòÉΓòÉΓòÉ 12.10. wcspbrk -- Locate wide-characters in string ΓòÉΓòÉΓòÉ
  6069.  
  6070.  
  6071. Syntax 
  6072.  
  6073. #include <wchar.h>
  6074.  
  6075. wchar_t *wcspbrk(const wchar_t *string1, const wchar_t *string2);
  6076.  
  6077.  
  6078. Description. 
  6079.  
  6080. The wcspbrk function locates the first occurrence in the string pointed to by 
  6081. string1 of any character from the string pointed to by string2. 
  6082.  
  6083.  
  6084. Return Value 
  6085.  
  6086. This function returns a pointer to the character, or NULL if no wchar_t from 
  6087. string2 occurs in string1. 
  6088.  
  6089.  
  6090. Related Information 
  6091.  
  6092.      wcschr  - Search wchar_t String for Given wchar_t 
  6093.      wcscspn - Find Offset of First wchar_t Match 
  6094.      wcsncmp - Compare wchar_t Strings 
  6095.      wcsrchr - Locate wchar_t Character in String 
  6096.      wcsspn  - Search wchar_t Characters in String 
  6097.      wcswcs  - Locate wchar_t Substring in wchar_t String 
  6098.      wchar.h 
  6099.  
  6100.  
  6101.  Example 
  6102.  
  6103.  This example returns a pointer to the first occurrence in the array string of 
  6104.  either a or b. 
  6105.  
  6106.   #include <stdio.h>
  6107.   #include <wchar.h>
  6108.  
  6109.   int main(void) {
  6110.       wchar_t  *result;
  6111.       wchar_t  ws[ 30 ];
  6112.       wchar_t  wc[ 8 ];
  6113.  
  6114.       mbstowcs(ws,"Blue Danube",12);
  6115.       mbstowcs(wc,"ab",3);
  6116.  
  6117.       result = wcspbrk( ws, wc);
  6118.  
  6119.       printf("The first occurrence of any of the characters \"%S\" in "
  6120.          "\"%S\" is \"%S\"\n", wc, ws, result);
  6121.  
  6122.       }
  6123.   /*******************  Output should be similar to:  *********************
  6124.  
  6125.   The first occurrence of any of the characters "ab" in "Blue Danube" is "anube"
  6126.  
  6127.   *************************************************************************/
  6128.  
  6129.  
  6130. ΓòÉΓòÉΓòÉ 12.11. wcsrchr -- Locate last occurence of wide-character in a string ΓòÉΓòÉΓòÉ
  6131.  
  6132.  
  6133. Syntax 
  6134.  
  6135. #include <wchar.h>
  6136.  
  6137. wchar_t *wcsrchr(const wchar_t *ws, wint_t wi);
  6138.  
  6139.  
  6140. Description. 
  6141.  
  6142. The wcsrchr function locates the last occurrence of wi in the string pointed to 
  6143. by ws.  The terminating wchar_t null character is considered to be part of the 
  6144. string. 
  6145.  
  6146.  
  6147. Return Values 
  6148.  
  6149. The wcsrchr function returns a pointer to the character, or a NULL pointer if 
  6150. wi does not occur in the string. 
  6151.  
  6152.  
  6153. Related Information 
  6154.  
  6155.      wcschr  - Search wchar_t String for Given wchar_t 
  6156.      wcscspn - Find Offset of First wchar_t Match 
  6157.      wcsspn  - Search wchar_t Characters in String 
  6158.      wcswcs  - Locate wchar_t Substring in wchar_t String 
  6159.      wcspbrk - Locate wchar_t Characters in String 
  6160.      wchar.h 
  6161.  
  6162.  
  6163.  Example 
  6164.  
  6165.  This example compares the use of wcschr and wcsrchr. It searches the string 
  6166.  for the first and last occurrence of p in the wide-character string. 
  6167.  
  6168.   #include <stdio.h>
  6169.   #include <wchar.h>
  6170.  
  6171.   int main(void) {
  6172.       wchar_t ws[40];
  6173.       wchar_t * ptr;
  6174.       wint_t    wi = (wint_t)'p';
  6175.  
  6176.       mbstowcs(ws,"computer program",19);
  6177.  
  6178.       ptr = wcschr( ws, wi );
  6179.  
  6180.       printf( "The first occurrence of %C in '%S' is '%S'\n", wi, ws, ptr );
  6181.  
  6182.       ptr = wcsrchr( ws, wi );
  6183.  
  6184.       printf( "The last occurrence of %C in '%S' is '%S'\n",  wi, ws, ptr );
  6185.       }
  6186.   /****************  Output should be similar to:  ******************
  6187.  
  6188.   The first occurrence of p in 'computer program' is 'puter program'
  6189.   The last occurrence of p in 'computer program' is 'program'
  6190.  
  6191.   *******************************************************************/
  6192.  
  6193.  
  6194. ΓòÉΓòÉΓòÉ 12.12. wcsspn -- Find length of wide-character substring ΓòÉΓòÉΓòÉ
  6195.  
  6196.  
  6197. Syntax 
  6198.  
  6199. #include <wchar.h>
  6200.  
  6201. size_t wcsspn(const wchar_t *string1, const wchar_t *string2);
  6202.  
  6203.  
  6204. Description. 
  6205.  
  6206. The wcsspn function finds the first occurrence of a wchar_t character in the 
  6207. string pointed to by string1 that is not contained in the set of wchar_t 
  6208. characters specified by the string pointed to by string2. 
  6209.  
  6210.  
  6211. Return Values 
  6212.  
  6213. The wcscspn function returns the index of the first character found.  This 
  6214. value is equivalent to the length of the initial substring of string1 that 
  6215. consists entirely of characters in string2. 
  6216.  
  6217.  
  6218. Related Information 
  6219.  
  6220.      wcschr  - Search wchar_t String for Given wchar_t 
  6221.      wcscspn - Find Offset of First wchar_t Match 
  6222.      wcsrchr - Locate wchar_t Character in String 
  6223.      wcsspn  - Search wchar_t Characters in String 
  6224.      wcswcs  - Locate wchar_t Substring in wchar_t String 
  6225.      wcspbrk - Locate wchar_t Characters in String 
  6226.      wchar.h 
  6227.  
  6228.  
  6229.  Example 
  6230.  
  6231.  This example finds the first occurrence in the string that is neither an a, b, 
  6232.  nor c.  Because the string in this example is cabbage, wcsspn returns 5, the 
  6233.  index of the segment of cabbage before a character that is not an a, b, or c. 
  6234.  
  6235.   #include <stdio.h>
  6236.   #include <wchar.h>
  6237.  
  6238.   int main(void) {
  6239.       wchar_t  ws[20];
  6240.       wchar_t  source[8];
  6241.       int index;
  6242.  
  6243.       mbstowcs(ws,"cabbage",8);
  6244.       mbstowcs(source,"abc",4);
  6245.  
  6246.       index = wcsspn( ws, source );
  6247.  
  6248.       printf( "The first %d characters of \"%S\" are found in \"%S\"\n",
  6249.              index, ws, source );
  6250.       }
  6251.   /****************  Output should be similar to:  ******************
  6252.  
  6253.   The first 5 characters of "cabbage" are found in "abc"
  6254.  
  6255.   *******************************************************************/
  6256.  
  6257.  
  6258. ΓòÉΓòÉΓòÉ 12.13. wcstok -- Convert wide-character string to token ΓòÉΓòÉΓòÉ
  6259.  
  6260.  
  6261. Syntax 
  6262.  
  6263. #include <wchar.h>
  6264.  
  6265. wchar_t *wcstok(wchar_t *string1, const wchar_t *string2);
  6266.  
  6267.  
  6268. Description 
  6269.  
  6270. The wcstok function reads a wide-character string1 as a series of zero or more 
  6271. tokens and wide-character string2 as the set of characters serving as 
  6272. delimiters of the tokens in string1.  The tokens in string1 can be separated by 
  6273. one or more of the delimiters from string2.  The tokens in string1 can be 
  6274. located by a series of calls to wcstok. 
  6275.  
  6276. In the first call to wcstok for a given string1, it searches for the first 
  6277. token in string1, skipping over leading delimiters.  A pointer to the first 
  6278. token is returned. 
  6279.  
  6280. To read the next token from string1, call wcstok with a NULL string1 argument. 
  6281. A NULL string1 argument causes wcstok to search for the next token in the 
  6282. previous token string.  Each delimiter is replaced by a null character.  The 
  6283. set of delimiters can vary from call to call, so string2 can take any value. 
  6284.  
  6285.  
  6286. Parameters 
  6287.  
  6288.  string1   Contains a pointer to the wide-character string to be searched. 
  6289.  
  6290.  string2   Contains a pointer to the string of wide-character token delimiters. 
  6291.  
  6292.  
  6293.  Return Values 
  6294.  
  6295.  The first time wcstok is called, it returns a pointer to the first token in 
  6296.  string1.  In later calls with the same token string, wcstok returns a pointer 
  6297.  to the next token in the string. A NULL pointer is returned when there are no 
  6298.  more tokens.  All tokens are null-terminated. 
  6299.  
  6300.  
  6301.  Related Information 
  6302.  
  6303.      wcsspn 
  6304.      wcswcs 
  6305.      wcstoul 
  6306.      wcstol 
  6307.      wchar.h 
  6308.  
  6309.  
  6310.  Example 
  6311.  
  6312.  Using a loop, the following example gathers tokens, deliminated by commas, 
  6313.  periods, semi-colons, or exclamation points, from  a string until no tokens 
  6314.  are left.  After processing the example returns the pointers to the tokens 
  6315.  abc, def, ghi, jk and lmnop. The next call to wcstok returns NULL and the loop 
  6316.  ends. 
  6317.  
  6318.   #include <stdio.h>
  6319.   #include <stdlib.h>
  6320.   #include <string.h>
  6321.   #include <wchar.h>
  6322.  
  6323.   int main(void) {
  6324.       wchar_t *wsList;
  6325.       wchar_t *wsToken;
  6326.       wchar_t *wsCodes;
  6327.  
  6328.       wsList  = (wchar_t *)calloc(80,sizeof(wchar_t));
  6329.       wsCodes = (wchar_t *)calloc(10,sizeof(wchar_t));
  6330.       wsToken = (wchar_t *)calloc(80,sizeof(wchar_t));
  6331.  
  6332.       mbstowcs(wsList, "abc,def.ghi;jk!lmnop",25);
  6333.       mbstowcs(wsCodes, ";,!.\0",5);
  6334.  
  6335.       /* the wide-character string pointed to by wsList is broken up
  6336.       into the tokens "abc", "def", "ghi", "jk" and "lmnop" ;
  6337.       the null terminator (\0) is encountered and execution stops    */
  6338.  
  6339.       wsToken = wcstok(wsList,wsCodes);
  6340.  
  6341.       do {
  6342.         printf("Token: %S\n", wsToken);
  6343.         wsToken = wcstok(NULL,wsCodes);
  6344.         } while (wsToken != NULL);
  6345.  
  6346.       free(wsList);
  6347.       free(wsCodes);
  6348.       free(wsToken);
  6349.       }
  6350.  
  6351.   /************************************************************************
  6352.  
  6353.   Output
  6354.  
  6355.   Token: abc
  6356.   Token: def
  6357.   Token: ghi
  6358.   Token: jk
  6359.   Token: lmnop
  6360.  
  6361.   ************************************************************************/
  6362.  
  6363.  
  6364. ΓòÉΓòÉΓòÉ 12.14. wcswcs -- Locate wide-character substring ΓòÉΓòÉΓòÉ
  6365.  
  6366.  
  6367. Syntax 
  6368.  
  6369. #include <wchar.h>
  6370.  
  6371. wchar_t *wcswcs(const wchar_t *string1, const wchar_t *string2);
  6372.  
  6373.  
  6374. Description. 
  6375.  
  6376. The wcswcs function locates the first occurrence in the string pointed to by 
  6377. string1 of the sequence of wchar_t characters (excluding the terminating 
  6378. wchar_t null character) in the string pointed to by string2. 
  6379.  
  6380. The wcswcs function returns a pointer to the located string or NULL if the 
  6381. string is not found.  If string2 points to a string with zero length, the 
  6382. function returns string1. 
  6383.  
  6384.  
  6385. Related Information 
  6386.  
  6387.      wcschr  - Search wchar_t String for Given wchar_t 
  6388.      wcscspn  - Find Offset of First wchar_t Match 
  6389.      wcspbrk  - Locate wchar_t Characters in String 
  6390.      wcsrchr  - Locate wchar_t Character in String 
  6391.      wcsspn  - Search wchar_t Characters in String 
  6392.      wchar.h 
  6393.  
  6394.  
  6395.  Example 
  6396.  
  6397.  This example finds the first occurrence of the wide character string pr in 
  6398.  buffer1. 
  6399.  
  6400.   #include <stdio.h>
  6401.   #include <wchar.h>
  6402.  
  6403.   #define SIZE 40
  6404.  
  6405.   int main(void) {
  6406.       wchar_t buffer1[SIZE];
  6407.       wchar_t * ptr;
  6408.       wchar_t wch[SIZE];
  6409.  
  6410.       mbstowcs(buffer1,"ski slope",SIZE);
  6411.       mbstowcs(wch,"sl",SIZE);
  6412.  
  6413.       ptr = wcswcs( buffer1, wch );
  6414.       printf( "The first occurrence of %S in '%S' is '%S'\n", wch, buffer1, ptr );
  6415.       }
  6416.   /****************  Output should be similar to:  ******************
  6417.  
  6418.   The first occurrence of sl in 'ski slope' is 'slope'
  6419.  
  6420.   *******************************************************************/
  6421.  
  6422.  
  6423. ΓòÉΓòÉΓòÉ 12.15. wcswidth -- Determines the display width of wide-character strings ΓòÉΓòÉΓòÉ
  6424.  
  6425.  
  6426. Syntax 
  6427.  
  6428. #include <wchar.h>
  6429.  
  6430. int wcswidth(const wchar_t *pwcs, size_t n);
  6431.  
  6432.  
  6433. Description 
  6434.  
  6435. The wcswidth function determines the number of display columns to be occupied 
  6436. by the number of wide-characters specified by the n parameter in the string 
  6437. pointed to by the pwcs parameter.  The LC_CTYPE category affects the behavior 
  6438. of the wcswidth  function.  Fewer than the number of wide-characters specified 
  6439. by the n parameter are counted if a null character is encountered first. 
  6440.  
  6441.  
  6442. Parameters 
  6443.  
  6444.  n         Specifies the maximum number of wide-characters whose display width 
  6445.            is to be determined. 
  6446.  
  6447.  pwcs      Contains a pointer to the wide-character string. 
  6448.  
  6449.  
  6450.  Return Values 
  6451.  
  6452.  The wcswidth function returns the number of display columns to be occupied by 
  6453.  the number of wide-characters (up to the terminating wide-character null) 
  6454.  specified by the n parameter (or fewer) in the string pointed to by the pwcs 
  6455.  parameter.  A value of zero is returned if the pwcs parameter is a 
  6456.  wide-character null pointer or a pointer to a wide-character null (that is, 
  6457.  pwcs or *pwcs is null).  If the pwcs parameter points to an unusable 
  6458.  wide-character code, -1 is returned. 
  6459.  
  6460.  
  6461.  Related Information 
  6462.  
  6463.      wcwidth - Determines the display width of wide-characters. 
  6464.      wchar.h - Header file for wide-character function prototypes. 
  6465.  
  6466.  
  6467.  Example 
  6468.  
  6469.  This example finds the display column width of a wide-character string. 
  6470.  
  6471.   #include <string.h>
  6472.   #include <stdlib.h>
  6473.   #include <wchar.h>
  6474.  
  6475.   #define  SIZE  80
  6476.  
  6477.   int main(void) {
  6478.       wchar_t pwcs[SIZE];
  6479.       int  retval,
  6480.       int  n;
  6481.  
  6482.       setlocale(LC_ALL, "");
  6483.  
  6484.       /* Let pwcs point to a wide-character null terminated
  6485.       ** string. Let n be the number of wide-characters whose
  6486.       ** display column width is to be determined.
  6487.       */
  6488.  
  6489.       mbstowcs(pwcs,"This is a test string",SIZE);
  6490.  
  6491.       retval = wcswidth( pwcs, n );
  6492.  
  6493.       if (retval == -1) {
  6494.         /* Error handling. Invalid wide-character code
  6495.         ** encountered in the wide-character string pwcs.
  6496.         */
  6497.         printf("Invalid wide character code was encountered in the wide-character string\n");
  6498.         }
  6499.  
  6500.       else
  6501.         printf("The width of this wide-character string \n %S \nis %d\n",pwcs,retval);
  6502.  
  6503.       }
  6504.  
  6505.  
  6506. ΓòÉΓòÉΓòÉ 12.16. wctype -- Define character class ΓòÉΓòÉΓòÉ
  6507.  
  6508.  
  6509. Syntax 
  6510.  
  6511. #include <wchar.h>
  6512.  
  6513. char wctype(const char *charclass);
  6514.  
  6515.  
  6516. Description 
  6517.  
  6518. This function returns a value that can be used as the second argument to 
  6519. subsequent calls of iswctype.  This value is determined according to the rules 
  6520. of the coded character set defined by character type information in the 
  6521. program's locale.  This function is defined for valid character class names as 
  6522. defined in the current locale.  Value returned by this function are valid until 
  6523. a call to setlocale modifies the category LC_CTYPE. 
  6524.  
  6525.  
  6526. Parameters 
  6527.  
  6528.  charclass    A string identifying a generic character class for which codeset 
  6529.               specific type information is required.  The following class names 
  6530.               are defined in all locales: 
  6531.  
  6532.               "alnum"         -  for the alpha numeric class. 
  6533.               "alpha"         -  for the alphabetic only class. 
  6534.               "cntrl"         -  for the control class. 
  6535.               "digit"         -  for the digit class. 
  6536.               "graph"         -  for the graphics character class. 
  6537.               "lower"         -  for the lower case character class. 
  6538.               "print"         -  for the printable character class. 
  6539.               "punct"         -  for the punctuation class. 
  6540.               "space"         -  for the space character class. 
  6541.               "upper"         -  for the upper case character class. 
  6542.               "xdigit"       -  for the digit or alpha character class. 
  6543.               "blank"         -  for the hexadecimal alpha numeric class. 
  6544.  
  6545.  Additional character class names defined in the locale definition file 
  6546.  (category LC_CTYPE) can also be specified. 
  6547.  
  6548.  
  6549.  Return Values 
  6550.  
  6551.  This function returns a value that can be used as the second argument to 
  6552.  subsequent calls of iswctype.  A 0 is returned if the given character class 
  6553.  name is not valid for the current locale. 
  6554.  
  6555.  
  6556.  Related Information 
  6557.  
  6558.      iswctype 
  6559.      wchar.h 
  6560.  
  6561.  
  6562.  Example 
  6563.  
  6564.  This example analyzes all characters between code 0x0 and code UPPER_LIMIT, 
  6565.  printing A for alphabetic characters, AN for alphanumerics, U for uppercase, L 
  6566.  for lowercase, D for digits, X for hexadecimal digits, S for spaces, PU for 
  6567.  punctuation, PR for printable characters, G for graphics characters, and C for 
  6568.  control characters. This example prints the code if printable. 
  6569.  
  6570.  The output of this example is a 256-line table showing the characters from 0 
  6571.  to 255 that possess the attributes tested. 
  6572.  
  6573.   #include <stdio.h>
  6574.   #include <wchar.h>
  6575.  
  6576.   #define UPPER_LIMIT   0xFF
  6577.  
  6578.   int main(void) {
  6579.       wint_t ch;
  6580.  
  6581.       for ( ch = 0; ch <= UPPER_LIMIT; ++ch ) {
  6582.         printf("\n%3d ", ch);
  6583.         printf("%#04x ", ch);
  6584.         printf("%3s ", iswctype(ch,wctype("alnum"))  ? "AN" : " ");
  6585.         printf("%2s ", iswctype(ch,wctype("alpha"))  ? "A"  : " ");
  6586.         printf("%2s",  iswctype(ch,wctype("cntrl"))  ? "C"  : " ");
  6587.         printf("%2s",  iswctype(ch,wctype("digit"))  ? "D"  : " ");
  6588.         printf("%2s",  iswctype(ch,wctype("graph"))  ? "G"  : " ");
  6589.         printf("%2s",  iswctype(ch,wctype("lower"))  ? "L"  : " ");
  6590.         printf(" %c",  iswctype(ch,wctype("blank"))  ? "B"  : " ");
  6591.         printf("%3s",  iswctype(ch,wctype("punct"))  ? "PU" : " ");
  6592.         printf("%2s",  iswctype(ch,wctype("space"))  ? "S"  : " ");
  6593.         printf("%3s",  iswctype(ch,wctype("print"))  ? "PR" : " ");
  6594.         printf("%2s",  iswctype(ch,wctype("upper"))  ? "U"  : " ");
  6595.         printf("%2s",  iswctype(ch,wctype("xdigit")) ? "X"  : " ");
  6596.         }
  6597.       }
  6598.  
  6599.  
  6600. ΓòÉΓòÉΓòÉ 12.17. wcwidth -- Determines the display width of wide-characters ΓòÉΓòÉΓòÉ
  6601.  
  6602.  
  6603. Syntax 
  6604.  
  6605. #include <wchar.h>
  6606.  
  6607. int wcwidth(wint_t wc);
  6608.  
  6609.  
  6610. Description 
  6611.  
  6612. The wcwidth function determines the number of display columns to be occupied by 
  6613. the wide-character specified by the wc parameter.  The LC_CTYPE function 
  6614. affects the behavior of the wcwidth function. 
  6615.  
  6616.  
  6617. Parameters 
  6618.  
  6619.  wc        Specifies a wide-character. 
  6620.  
  6621.  
  6622.  Return Values 
  6623.  
  6624.  The wcwidth function returns the number of display columns to be occupied by 
  6625.  the wc parameter.  If the wc parameter is a wide-character null, a value of 0 
  6626.  is returned.  If the wc parameter points to an unusable wide-character code, 
  6627.  -1 is returned. 
  6628.  
  6629.  
  6630.  Related Information 
  6631.  
  6632.      wcswidth 
  6633.      wchar.h 
  6634.  
  6635.  
  6636.  Example 
  6637.  
  6638.  This example finds the display column width of a wide-character. 
  6639.  
  6640.   #include <stdlib.h>
  6641.   #include <string.h>
  6642.   #include <wchar.h>
  6643.  
  6644.   int main(void) {
  6645.       wchar_t wc = 0x41;
  6646.       int   retval;
  6647.  
  6648.       setlocale(LC_ALL, "");
  6649.  
  6650.       /* Let wc be the wide-character whose
  6651.       ** display width is to be found.
  6652.       */
  6653.       retval= wcwidth( wc );
  6654.  
  6655.       if(retval == -1) {
  6656.         /*
  6657.         ** Error handling. Invalid wide-character in wc.
  6658.         */
  6659.         printf("Invalid wide-character\n");
  6660.         }
  6661.       else
  6662.         printf("The width of the wide-character\n%C\nis %d\n",wc,retval);
  6663.       }
  6664.  
  6665.  
  6666. ΓòÉΓòÉΓòÉ 13. Utilities for I18N ΓòÉΓòÉΓòÉ
  6667.  
  6668. The following command-line programs are provided with the OS/2 I18N package: 
  6669.  
  6670.  Program     Purpose 
  6671.  gencat      Constructs message catalog files. 
  6672.  mkcatdef    Constructs message #define .h files to be used in an application 
  6673.              program to reference catalog file entries. 
  6674.  runcat      A command file which builds both message catalogs, and the include 
  6675.              files for those catalogs (via mkcatdef and gencat). 
  6676.  cvtmsg      Converts an OS/2 mkmsgf input file into an XPG4 gencat input file. 
  6677.  locale      Displays the currently active locale categories. 
  6678.  uconvdef    Compiles or generates a UCS-2 (Unicode) conversion table for use 
  6679.              by the iconv library. 
  6680.  
  6681.  
  6682. ΓòÉΓòÉΓòÉ 13.1. gencat - Create/modify a message catalog ΓòÉΓòÉΓòÉ
  6683.  
  6684.  
  6685. Syntax 
  6686.  
  6687.   gencat CatalogFile [ SourceFile ... ]
  6688.  
  6689.  
  6690. Description 
  6691.  
  6692. The gencat command can be used to create a message catalog (usually  *.cat) 
  6693. from a message text source file (usually *.msg). 
  6694.  
  6695. If a message catalog with the name specified by the CatalogFile parameter 
  6696. exists, the gencat command modifies it according to the statements in the 
  6697. specified message source files.  If it does not exist, the gencat command 
  6698. creates a catalog file with the name specified by the CatalogFile parameter. 
  6699.  
  6700. You can specify any number of message source files.  The gencat command 
  6701. processes multiple source files, one after another, in the sequence specified. 
  6702. Each successive source file modifies the catalog.  If you do not specify a 
  6703. source file, the gencat command accepts message source data from standard 
  6704. input. 
  6705.  
  6706. The gencat command does not accept symbolic message identifiers. You must run 
  6707. the mkcatdef command if you want to use symbolic message identifiers. 
  6708.  
  6709. After entering your messages into a source file, you must use the gencat 
  6710. command to process the source file to create a message catalog. 
  6711.  
  6712.  
  6713. Parameters 
  6714.  
  6715.  CatalogFile   Name of catalog file to be created or modified. 
  6716.  
  6717.  SourceFile    List of 0 or more message source file names from which the 
  6718.                catalog is to be updated or created.  Each file name must be 
  6719.                separated by at least one space. 
  6720.  
  6721.  
  6722.  Return Codes 
  6723.  
  6724.  0         Successful 
  6725.  1         Failure 
  6726.  
  6727.  
  6728.  Related Information 
  6729.  
  6730.      mkcatdef 
  6731.      runcat 
  6732.      catopen 
  6733.      catgets 
  6734.      catopen 
  6735.  
  6736.  
  6737.  Example 
  6738.  
  6739.  To generate a test.cat catalog from the source file test.msg, enter: 
  6740.  
  6741.     gencat test.cat test.msg
  6742.  
  6743.  The test.msg file does not contain symbolic identifiers. 
  6744.  
  6745.  
  6746. ΓòÉΓòÉΓòÉ 13.2. mkcatdef - Construct message #define .h files ΓòÉΓòÉΓòÉ
  6747.  
  6748.  
  6749. Syntax 
  6750.  
  6751.   mkcatdef SymbolName SourceFile ...  [  -h ]
  6752.  
  6753.  
  6754. Description 
  6755.  
  6756. The mkcatdef command preprocesses a message source file for input to the gencat 
  6757. command. 
  6758.  
  6759. The SourceFile message file contains symbolic identifiers.  The mkcatdef 
  6760. command produces the SymbolName.h file, containing statements that equate 
  6761. symbolic identifiers with the set numbers and message ID numbers assigned by 
  6762. the mkcatdef command. 
  6763.  
  6764. The mkcatdef command creates two outputs.  The first is a header file called 
  6765. SymbolName.h.  You must include this SymbolName.h file in your application 
  6766. program to associate the symbolic names to the set and message numbers assigned 
  6767. by the mkcatdef command. 
  6768.  
  6769. The mkcatdef command sends message source data, with numbers instead of 
  6770. symbolic identifiers, to standard output.  This output is suitable as input to 
  6771. the gencat command.  You can use the mkcatdef command output as input to the 
  6772. gencat command in the following ways: 
  6773.  
  6774.      Use the mkcatdef command with a > (redirection symbol) to write the new 
  6775.       message source to a file.  Use this file as input to the gencat command. 
  6776.  
  6777.      Pipe the mkcatdef command output file directly to the gencat command. 
  6778.  
  6779.      Use the runcat command rather than the mkcatdef command.  The runcat 
  6780.       command automatically sends the message source file through the mkcatdef 
  6781.       command and then pipes the file to the gencat command. 
  6782.  
  6783.  After running the mkcatdef command, you can use symbolic names in an 
  6784.  application to refer to messages. 
  6785.  
  6786.  
  6787.  Parameters 
  6788.  
  6789.  SymbolName Name used to build the .h message file name. 
  6790.  
  6791.  SourceFile List of 1 or more message source file names.  These message files 
  6792.            contain symbolic identifiers from which the SymbolName.h file is 
  6793.            generated.  Each message source file name must be separated by at 
  6794.            least one space. 
  6795.  
  6796.  Flags 
  6797.  
  6798.            -h      Suppresses the generation of a SymbolName.h file.  This flag 
  6799.                    must be the last argument to the mkcatdef command. 
  6800.  
  6801.  
  6802.  Return Codes 
  6803.  
  6804.  0  Successful 
  6805.  1  Failure 
  6806.  
  6807.  
  6808.  Related Information 
  6809.  
  6810.      gencat 
  6811.      runcat 
  6812.      catopen 
  6813.      catgets 
  6814.      catopen 
  6815.  
  6816.  
  6817.  Example 
  6818.  
  6819.  To process the symb.msg message source file and redirect the out- put to the 
  6820.  symb.src file, enter: 
  6821.  
  6822.          mkcatdef symb symb.msg > symb.src
  6823.  
  6824.  The generated symb.h file looks similar to the following: 
  6825.  
  6826.   #ifdef        _H_SYMB_MSG
  6827.   #define       _H_SYMB_MSG
  6828.   #include <limits.h>
  6829.   #include <nl_types.h>
  6830.   #define       MF_SYMB "symb.cat"
  6831.   /* The following was generated from symb.src. */
  6832.   /* definitions for set MSFAC */
  6833.   #define       SYM_FORM        1
  6834.   #define       SYM_LEN 2
  6835.   #define       MSG_H   6
  6836.   #endif
  6837.  
  6838.  The mkcatdef command also creates the symb.src message catalog source file for 
  6839.  the gencat command with numbers assigned to the symbolic identifiers: 
  6840.  
  6841.   $quote " Use double quotation marks to delimit message text
  6842.   $delset 1
  6843.   $set 1
  6844.   1     "Symbolic identifiers can only contain alphanumeric \
  6845.   characters or the _ (underscore character)\n"
  6846.   2     "Symbolic identifiers cannot be more than 65 \
  6847.   characters long\n"
  6848.   5     "You can mix symbolic identifiers and numbers\n"
  6849.   $quote
  6850.   6     remember to include the ".h" file in your program
  6851.  
  6852.  The assigned message numbers are noncontiguous because the source file 
  6853.  contained a specific number.  The mkcatdef program always assigns the previous 
  6854.  number plus 1 to a symbolic identifier. 
  6855.  
  6856.  Note: The mkcatdef command inserts a $delset command before a $set command in 
  6857.  the output message source file. This means you cannot add, delete, or replace 
  6858.  single messages in an existing catalog when piping to the gencat command.  You 
  6859.  must enter all messages in the set. 
  6860.  
  6861.  
  6862. ΓòÉΓòÉΓòÉ 13.3. runcat - Build message catalog ΓòÉΓòÉΓòÉ
  6863.  
  6864.  
  6865. Syntax 
  6866.  
  6867.   runcat CatalogName SourceFile [ CatalogFile ]
  6868.  
  6869.  
  6870. Description 
  6871.  
  6872. The runcat command invokes the mkcatdef command and pipes the message catalog 
  6873. source data (the output from mkcatdef) to the gencat program. 
  6874.  
  6875. The file specified by the SourceFile parameter contains the message text with 
  6876. your symbolic identifiers.  The mkcatdef program uses the CatalogName parameter 
  6877. to generate the name of the symbolic definition file by adding .h to the end of 
  6878. the CatalogName value, and to generate the symbolic name for the catalog file 
  6879. by adding MF_ to the beginning of the CatalogName value.  The definition file 
  6880. must be included in your application program.  The symbolic name for the 
  6881. catalog file can be used in the library functions (such as the catopen 
  6882. subroutine). 
  6883.  
  6884. The CatalogFile parameter is the name of the catalog file created by the gencat 
  6885. command.  If you do not specify this parameter, the gencat command names the 
  6886. catalog file by adding .cat to the end of the CatalogName value.  This file 
  6887. name can also be used in the catopen library function. 
  6888.  
  6889.  
  6890. Return Codes 
  6891.  
  6892.  0  Successful 
  6893.  1  Failure 
  6894.  
  6895.  
  6896.  Related Information 
  6897.  
  6898.      gencat 
  6899.      mkcatdef 
  6900.      catopen 
  6901.      catgets 
  6902.      catopen 
  6903.  
  6904.  
  6905.  Example 
  6906.  
  6907.  To generate a catalog named test.cat from the message source file test.msg, 
  6908.  enter: 
  6909.  
  6910.     runcat test test.msg
  6911.  
  6912.  
  6913. ΓòÉΓòÉΓòÉ 13.4. cvtmsg - Convert OS/2 mkmsgf file to XPG4 gencat file ΓòÉΓòÉΓòÉ
  6914.  
  6915.  
  6916. Syntax 
  6917.  
  6918.      cvtmsg   input_OS2_file   output_XPG4_file   [options]
  6919.  
  6920.  
  6921. Description 
  6922.  
  6923. The cvtmsg utility is used to convert the source for an OS/2 message file (Make 
  6924. Message File (MKMSGF) format) into the source for an XPG/4 message file 
  6925. (Internationalization (I18N) Generate Catalog (gencat) format). 
  6926.  
  6927. The input file must contain source which is compilable by the MKMSGF utility 
  6928. from the OS/2 Toolkit.  The input file will not be modified by this process. 
  6929.  
  6930. An input file example:
  6931.  
  6932.      ; comment record.  Semicolon must be in column 1.
  6933.      ; The next line defines the message component value.
  6934.      MSG
  6935.      ;
  6936.      MSG0001E: Message text for message number one, which is an
  6937.      error message.  %1 %2 %3 %4 %5 %6 %7 %8 %9 indicate
  6938.      replacement variables.
  6939.      ;
  6940.      ;  Message number two is not used because of "?" after the number.
  6941.      MSG0002?:
  6942.      ;
  6943.      MSG0003I: Message text for message number three, which is an
  6944.      informational message.
  6945.      ;
  6946.      MSG0004I: This shows a special variable: %0
  6947.      ;
  6948.      MSG0005I: This is the last message in this example.
  6949.  
  6950. Special conversion considerations for the input file: 
  6951.  
  6952.      Comments are lines which have a semicolon ";" in column 1.  The entire 
  6953.       line is considered part of the comment text. 
  6954.  
  6955.      Replacement variables are defined as: %1 %2 %3 %4 %5 %6 %7 %8 %9. All 
  6956.       replacement variables are considered to be character string values. 
  6957.  
  6958.      The value %0 indicates that a new line character is NOT to be added to 
  6959.       the end of this text line;  it is NOT a replacement variable. Any text 
  6960.       which follows the %0 is ignored and discarded. 
  6961.  
  6962.      Messages defined with a type of "?" are place-holders and do not really 
  6963.       define a usable message. 
  6964.  
  6965.  The output file will contain the converted message source which is compilable 
  6966.  by the gencat utility. 
  6967.  
  6968.  The OS/2 message source shown in the example above will create the following 
  6969.  XPG/4 message source when the default options are used (the /C option was 
  6970.  specified to include the converted comment text): 
  6971.  
  6972.        $  comment record.  Semicolon must be in column 1.
  6973.        $  The next line defines the message component value.
  6974.        $
  6975.        $quote "     (Define message text delimiter)
  6976.        $set 1       (Message component: MSG)
  6977.        $
  6978.        0001    "MSG0001: Message text for message number one, which is an\n\
  6979.        error message.  %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s indicate\n\
  6980.        replacement variables.\n"
  6981.        $
  6982.        $   Message number two is not used because of "?" after the number.
  6983.        $
  6984.        0003    "Message text for message number three, which is an\n\
  6985.        informational message.\n"
  6986.        $
  6987.        0004    "This shows a special variable: "
  6988.        $
  6989.        0005    "This is the last message in this example.\n"
  6990.  
  6991.  The OS/2 message source shown in the example above will create the following 
  6992.  XPG/4 message source when the /S option was specified to create symbolic 
  6993.  message IDs: 
  6994.  
  6995.        $  comment record.  Semicolon must be in column 1.
  6996.        $quote "     (Define message text delimiter)
  6997.        $set 1       (Message component: MSG)
  6998.        $
  6999.        MSG0001 "MSG0001: Message text for message number one, which is an\n\
  7000.        error message.  %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s indicate\n\
  7001.        replacement variables.\n"
  7002.        MSG0003 "Message text for message number three, which is an\n\
  7003.        informational message.\n"
  7004.        MSG0004 "This shows a special variable: "
  7005.        MSG0005 "This is the last message in this example.\n"
  7006.  
  7007.  Special conversion considerations for the output file: 
  7008.  
  7009.      Comments are lines which have "$" in column 1 and a blank in column 2. 
  7010.       Comment text can also be defined on the "$quote" and "$set" statements. 
  7011.  
  7012.      The "$set " line defines the delimiter character which is used to 
  7013.       identify the text of the message. 
  7014.  
  7015.      Replacement variables are defined as "%n$s", where "n" is a one digit 
  7016.       number (1-9) and "s" identifies the replacement text is a string of 
  7017.       characters. 
  7018.  
  7019.  The conversion is performed as follows: 
  7020.  
  7021.      OS/2 comments are lines which have a semicolon ";" in column 1, with 
  7022.       comment text starting in column 2.  The conversion default is that 
  7023.       comments are not included in the output source.  When the "/C" option is 
  7024.       specified, OS/2 comments are converted to XPG/4 comments and are included 
  7025.       in the output source.  XPG/4 comments have a "$" in column 1, a blank in 
  7026.       column 2, with comment text starting in column 3. 
  7027.  
  7028.      Converted message text will always be delimited with double quotes. This 
  7029.       tool will add a  $quote "  statement for this purpose. 
  7030.  
  7031.      All converted messages will always be added to be XPG/4 message set 
  7032.       number 1.  This tool will add a "$set 1" statement for this purpose. 
  7033.  
  7034.      The formatting of the OS/2 message text will be preserved in the 
  7035.       converted XPG/4 message text.  New line characters "\n" will be added to 
  7036.       maintain formatting. 
  7037.  
  7038.      A new line character will be added at the end of the XPG/4 message text 
  7039.       when "%0" is not defined at the end of the OS/2 message text. 
  7040.  
  7041.      OS/2 replacement variables are defined as: %1 %2 %3 %4 %5 %6 %7 %8 %9, 
  7042.       and are always considered to be character string values.  Each variable 
  7043.       is converted to an equivalent XPG/4 variable format: %1$s %2$s %3$s %4$s 
  7044.       %5$s %6$s %7$s %8$s %9$s.  The one digit number remains the same (to 
  7045.       insure proper sequencing) and each variable must be a character string 
  7046.       replacement variable. 
  7047.  
  7048.      OS/2 messages defined with a type of "?" are place-holders and do not 
  7049.       really define a usable message.  These messages are not included in the 
  7050.       output XPG/4 message file. 
  7051.  
  7052.      OS/2 messages which have a message type of "E" (error) or "W" (warning) 
  7053.       will have the message identifier added to the beginning of the message 
  7054.       text (see MSG0001 in the above example).  This will simulate the function 
  7055.       provided by DosGetMessage for these types of messages. 
  7056.  
  7057.  
  7058.  Parameters 
  7059.  
  7060.  input_OS2_file   This parameter indicates the name of the input file which 
  7061.                   contains the message source for the MKMSGF utility (from the 
  7062.                   OS/2 Toolkit). 
  7063.  
  7064.  output_XPG4_file This parameter indicates the name of the output file to which 
  7065.                   the converted message source will be written in a format 
  7066.                   compatible with the gencat utility. 
  7067.  
  7068.  options 
  7069.  
  7070.                   /C     Include the text from all OS/2 source comments in the 
  7071.                          generated XPG/4 message source.  Otherwise, OS/2 
  7072.                          comment text is not included in the output file. 
  7073.  
  7074.                   /P     Prompt at the beginning of execution to ensure that 
  7075.                          the passed parameters were correctly defined. The user 
  7076.                          will have the option to terminate processing before 
  7077.                          any conversion is performed. 
  7078.  
  7079.                   /S     Generate symbolic XPG/4 message IDs which are the same 
  7080.                          as the OS/2 message ID (3 character component plus the 
  7081.                          4 digit number, i.e. MSG0001). Otherwise, the XPG/4 
  7082.                          message ID will consist of only the numeric part of 
  7083.                          the OS/2 message ID (i.e. 0001). 
  7084.  
  7085.  
  7086.  Return Codes 
  7087.  
  7088.  0         Successful 
  7089.  1         Failure 
  7090.  
  7091.  
  7092.  Related Information 
  7093.  
  7094.      gencat 
  7095.      runcat 
  7096.      catopen 
  7097.      catgets 
  7098.      catopen 
  7099.  
  7100.  
  7101. ΓòÉΓòÉΓòÉ 13.5. locale - Display locale categories. ΓòÉΓòÉΓòÉ
  7102.  
  7103.  
  7104. Syntax 
  7105.  
  7106.   locale
  7107.  
  7108.  
  7109. Description 
  7110.  
  7111. This utility displays the locale that is currently active for each locale 
  7112. category.  This is the same string of data that is returned from the setlocale 
  7113. function if a NULL locale is specified and LC_ALL is specified for the 
  7114. catagory. 
  7115.  
  7116.  
  7117. Parameters 
  7118.  
  7119. There are no parameters. 
  7120.  
  7121.  
  7122. Return Codes 
  7123.  
  7124. The return code is always 0. 
  7125.  
  7126.  
  7127. Related Information 
  7128.  
  7129.      setlocale 
  7130.  
  7131.  
  7132.  Example 
  7133.  
  7134.  If LANG were set, for example, to En_US.IBM-437, then the program would 
  7135.  display: 
  7136.  
  7137.  
  7138.       ENUS437 ENUS437 ENUS437 ENUS437 ENUS437 ENUS437
  7139.  
  7140.  
  7141. ΓòÉΓòÉΓòÉ 13.6. uconvdef - Compile conversion table ΓòÉΓòÉΓòÉ
  7142.  
  7143.  
  7144. Syntax 
  7145.  
  7146.     uconvdef [ -f SrcFile ] [ -v ] UconvTable
  7147.  
  7148.  
  7149. Description 
  7150.  
  7151. Compiles or generates a UCS-2 (Unicode) conversion table for use by the iconv 
  7152. library. 
  7153.  
  7154. The uconvdef command reads SrcFile and creates a compiled conversion table in 
  7155. UconvTable. The SrcFile defines a mapping between UCS-2 and multibyte code sets 
  7156. (one or more bytes per character). The UconvTable is in a format that can be 
  7157. loaded by the UCSTBL conversion method located in the i18n\locale\iconv 
  7158. directory. This method uses the table to support UCS-2 conversions in both 
  7159. directions. 
  7160.  
  7161. The conversion table can be accessed from the iconv programming interfaces, if 
  7162. the following steps are taken: 
  7163.  
  7164.      Name the compiled table using the name of the non-UCS-2 code set (e.g. 
  7165.       IBM-850). 
  7166.  
  7167.      Place the table in a directory called "uconvtab". The default system 
  7168.       directory is i18n\locale\uconvtab. If another directory is used, the 
  7169.       LOCPATH environment variable will need to be set to include parent 
  7170.       directory (e.g. i18n\locale). 
  7171.  
  7172.  
  7173.  Parameters 
  7174.  
  7175.  UconvTable   Specifies the path name of the compiled table to be created. This 
  7176.               should be the name of the code set that defines conversions into 
  7177.               and out of UCS-2. 
  7178.  
  7179.  Flags 
  7180.  
  7181.               -f SrcFile     Specifies the conversion table source file.  If 
  7182.                              this flag is not used, standard input is read. 
  7183.  
  7184.               -v             Causes output of the processed file statements. 
  7185.  
  7186.  
  7187.  Return Codes 
  7188.  
  7189.  0    Successful completion. 
  7190.  >0   An error occurred. 
  7191.  
  7192.  
  7193.  Related Information 
  7194.  
  7195.      iconv_open 
  7196.      iconv 
  7197.      iconv_close 
  7198.      uconvdef source file format 
  7199.  
  7200.  
  7201.  Example 
  7202.  
  7203.  This example creates a conversion table between IBM-850 and UCS-2: 
  7204.  
  7205.       uconvdef -f IBM-850.ucmap IBM-850
  7206.  
  7207.  
  7208.  uconvdef Source File Format 
  7209.  
  7210.  Conversion mapping values are defined using UCS-2 symbolic character names 
  7211.  followed by character encoding (code point) values for the multibyte code set. 
  7212.  For example, 
  7213.  
  7214.   <U0020>                \x20
  7215.  
  7216.  represents the mapping between the <U0020> UCS-2 symbolic character name for 
  7217.  the space character and the \x20 hexadecimal code point for the space 
  7218.  character in ASCII. 
  7219.  
  7220.  In addition to the code set mappings, directives are interpreted by the 
  7221.  uconvdef command to produce the compiled table. These directives must precede 
  7222.  the code set mapping section. They consist of the following keywords 
  7223.  surrounded by < > (angle brackets), starting in column 1, followed by white 
  7224.  space and the value to be assigned to the symbol: 
  7225.  
  7226.  KEYWORD               DESCRIPTION 
  7227.  
  7228.  <code_set_name>       The name of the coded character set, enclosed in 
  7229.                        quotation marks (" "), for which the character set 
  7230.                        description file is defined. 
  7231.  
  7232.  <mb_cur_max>          The maximum number of bytes in a multibyte character. 
  7233.                        The default value is 1. 
  7234.  
  7235.  <mb_cur_min>          An unsigned positive integer value that defines the 
  7236.                        minimum number of bytes in a character for the encoded 
  7237.                        character set.  The value is less than or equal to 
  7238.                        <mb_cur_max>.  If not specified, the minimum number is 
  7239.                        equal to <mb_cur_max>. 
  7240.  
  7241.  <escape_char>         The escape character used to indicate that the character 
  7242.                        following is interpreted in a special way.  This 
  7243.                        defaults to a backslash (). 
  7244.  
  7245.  <comment_char>        The character that, when placed in column 1 of a charmap 
  7246.                        line, is used to indicate that the line is ignored. The 
  7247.                        default character is the number sign (#). 
  7248.  
  7249.  <char_name_mask>      A quoted string consisting of format specifiers for the 
  7250.                        UCS-2 symbolic names. This must be a value of AXXXX, 
  7251.                        indicating an alphabetic character followed by 4 
  7252.                        hexadecimal digits. Also, the alphabetic character must 
  7253.                        be a U, and the hexadecimal digits must represent the 
  7254.                        UCS-2 code point for the character. An example of a 
  7255.                        symbolic character name based on this mask is <U0020> 
  7256.                        Unicode space character. 
  7257.  
  7258.  <uconv_class>         Specifies the type of the code set. This type is used to 
  7259.                        direct uconvdef on what type of table to build. It is 
  7260.                        also stored in the table to indicate the type of 
  7261.                        processing algorithm in the UCS conversion methods. It 
  7262.                        must be one of the following: 
  7263.  
  7264.                            SBCS  Single-byte encoding 
  7265.                            DBCS  Stateless double-byte, single-byte, or mixed 
  7266.                             encodings 
  7267.                            EBCDIC_STATEFUL  Stateful double-byte, single-byte, 
  7268.                             or mixed encodings 
  7269.                            MBCS  Stateless multibyte encoding 
  7270.  
  7271.  <locale>              Specifies the default locale name to be used if locale 
  7272.                        information is needed. 
  7273.  
  7274.  <subchar>             Specifies the encoding of the default substitute 
  7275.                        character in the multibyte code set. 
  7276.  
  7277.  The code set mapping section consists of a sequence of mapping definition 
  7278.  lines preceded by a CHARMAP declaration and terminated by an END CHARMAP 
  7279.  declaration. Empty lines and lines containing <comment_char> in the first 
  7280.  column are ignored. 
  7281.  
  7282.  Symbolic character names in mapping lines must follow the pattern specified in 
  7283.  the <char_name_mask>, except for the reserved symbolic name, <unassigned>, 
  7284.  that indicates the associated code points are unassigned. 
  7285.  
  7286.  Each noncomment line of the character set mapping definition must be in one of 
  7287.  the following formats: 
  7288.  
  7289.  Format 1 
  7290.  
  7291.        "%s %s %s/n", <symbolic-name>, <encoding>, <comments>
  7292.  
  7293.        For example:
  7294.  
  7295.        <U3004>                \x81\x57
  7296.  
  7297.  This format defines a single symbolic character name and a corresponding 
  7298.  encoding. 
  7299.  
  7300.  A character following an escape character is interpreted as itself; for 
  7301.  example, the sequence <\\\>> represents the symbolic name \> enclosed between 
  7302.  angle brackets. 
  7303.  
  7304.  The encoding part is expressed as one or more concatenated decimal, 
  7305.  hexadecimal, or octal constants in the following formats: 
  7306.  
  7307.      "%cd%d", <escape_char>, <decimal byte value> 
  7308.      "%cx%x", <escape_char> , <hexadecimal byte value> 
  7309.      "%c%o", <escape_char>, <octal byte value> 
  7310.  
  7311.  Decimal constants are represented by two or more decimal digits preceded by 
  7312.  the escape character and the lowercase letter d, as in d97 or d143. 
  7313.  Hexadecimal constants are represented by two or more hexadecimal digits 
  7314.  preceded by an escape character and the lowercase letter x, as in x61 or x8f. 
  7315.  Octal constants are represented by two or more octal digits preceded by an 
  7316.  escape character. 
  7317.  
  7318.  Each constant represents a single-byte value. When constants are concatenated 
  7319.  for multibyte character values, the last value specifies the least significant 
  7320.  octet and preceding constants specify successively more significant octets. 
  7321.  
  7322.  Format 2 
  7323.  
  7324.     "%s. . .%s %s %s/n", <symbolic-name>, <symbolic-name>, <encoding>, <comments>
  7325.  
  7326.   For example:
  7327.  
  7328.   <U3003>...<U3006>      \x81\x56
  7329.  
  7330.  This format defines a range of symbolic character names and corresponding 
  7331.  encodings. The range is interpreted as a series of symbolic names formed from 
  7332.  the alphabetic prefix and all the values in the range defined by the numeric 
  7333.  suffixes. 
  7334.  
  7335.  The listed encoding value is assigned to the first symbolic name, and 
  7336.  subsequent symbolic names in the range are assigned corresponding incremental 
  7337.  values. For example, the line: 
  7338.  
  7339.   <U3003>...<U3006>      \x81\x56
  7340.  
  7341.  is interpreted as: 
  7342.  
  7343.   <U3003>                \x81\x56
  7344.   <U3004>                \x81\x57
  7345.   <U3005>                \x81\x58
  7346.   <U3006>                \x81\x59
  7347.  
  7348.  Format 3 
  7349.  
  7350.        "<unassigned> %s. . .%s %s/n", <encoding>, <encoding>, <comments>
  7351.  
  7352.  This format defines a range of one or more unassigned encodings. For example, 
  7353.  the line: 
  7354.  
  7355.   <unassigned>   \x9b...\x9c
  7356.  
  7357.   is interpreted as:
  7358.  
  7359.   <unassigned>   \x9b
  7360.   <unassigned>   \x9c
  7361.  
  7362.  
  7363. ΓòÉΓòÉΓòÉ 14. Installation ΓòÉΓòÉΓòÉ
  7364.  
  7365.  
  7366. ΓòÉΓòÉΓòÉ 14.1. Overview ΓòÉΓòÉΓòÉ
  7367.  
  7368. Included in this toolkit is a program that installs the I18N files required for 
  7369. the runtime environment and configures the CONFIG.SYS information. 
  7370.  
  7371. It is a command line program (.EXE) which provides no user interface other than 
  7372. the command line parameters and return code. 
  7373.  
  7374. It is assumed that this program will be called by individual product 
  7375. installation programs. 
  7376.  
  7377.  
  7378. ΓòÉΓòÉΓòÉ 14.2. Goals ΓòÉΓòÉΓòÉ
  7379.  
  7380. The goals of this install are: 
  7381.  
  7382.      Provide consistent install behavior of the I18N code among the various 
  7383.       products that install it. 
  7384.  
  7385.      Reduce code redundancy caused by multiple products installing the same 
  7386.       code in different directories on the user's system. 
  7387.  
  7388.      Provide a syslevel file for support purposes. 
  7389.  
  7390.      Remove knowledge of install details from other product's installation 
  7391.       code. 
  7392.  
  7393.  
  7394. ΓòÉΓòÉΓòÉ 14.3. Functions ΓòÉΓòÉΓòÉ
  7395.  
  7396.  This program's functions include: 
  7397.  
  7398.      Determine if this version of the I18N package should be installed by 
  7399.       examining the environment variable, I18NDIR and the syslevel file, 
  7400.       SYSLEVEL.I18. 
  7401.  
  7402.      Create all of the required I18N directories if they do not already exist. 
  7403.  
  7404.      Install the I18N runtime code (setloc1.dll) located in the path specified 
  7405.       by the caller, if necessary. 
  7406.  
  7407.      Install the I18N locale files (*.dll) located in the path specified by 
  7408.       the caller, if necessary. 
  7409.  
  7410.      Install the syslevel file, SYSLEVEL.I18, if necessary. 
  7411.  
  7412.      Update CONFIG.SYS with the I18N information if necessary. 
  7413.  
  7414.  
  7415. ΓòÉΓòÉΓòÉ 14.4. Installation Process ΓòÉΓòÉΓòÉ
  7416.  
  7417. If the I18NDIR environment variable is not found, then the I18N package has not 
  7418. been installed on the system or it is a down level version.  Install the new 
  7419. version using the drive specified by the caller.  If no drive letter is 
  7420. specified, then the boot drive will be used.  The default directory, IBMI18N, 
  7421. will be used. Create the directory if it does not exist.  Update config.sys. 
  7422.  
  7423. The following is installed in the IBMI18N directory: 
  7424.  
  7425.      syslevel file, SYSLEVEL.I18 
  7426.      \DLL\SETLOC1.DLL 
  7427.      \LOCALE\all locale DLL's provided by the caller 
  7428.      \LOCALE\ALIASES file 
  7429.  
  7430.  If the I18NDIR environment variable exists, the directory specified in the 
  7431.  environment variable will be used as the target directory. Compare the 
  7432.  existing syslevel file with the syslevel file in the install package. 
  7433.  
  7434.      If the install package is a newer version: 
  7435.  
  7436.         -  Replace the SETLOC1.DLL. 
  7437.         -  Replace the SYSLEVEL.I18 file. 
  7438.         -  Replace existing locale DLLs. 
  7439.         -  Add any new locale DLLs provided by the caller. 
  7440.         -  Do not remove any existing locale DLLs. 
  7441.         -  Replace the ALIASES file. 
  7442.  
  7443.      If the install package is an older version or the same version: : 
  7444.  
  7445.         -  Do not replace the SETLOC1.DLL. 
  7446.         -  Do not replace the SYSLEVEL.I18 file. 
  7447.         -  Do not replace existing locale DLLs. 
  7448.         -  Add any new locale DLLs provided by the caller. 
  7449.         -  Do not remove any existing locale DLLs. 
  7450.         -  Do not replace the existing ALIASES file. 
  7451.  
  7452.  It may seem strange that we want to continue with the install if the versions 
  7453.  are the same or if the caller is installing an older version.  However, 
  7454.  multiple products install this package and they don't all ship the same set of 
  7455.  locale files.  So, we want to make sure that we always have a "union" of all 
  7456.  the different locale files installed by the different products. 
  7457.  
  7458.  If the following occurs: 
  7459.  
  7460.      the program encounters a "disk full" condition while copying the source 
  7461.       files to the user's machine AND 
  7462.      the caller specified a target drive that is different from the drive on 
  7463.       which the disk full error occurred AND 
  7464.      the caller specified UPDCFG=Y (this is also the default) 
  7465.  
  7466.  then this install program will attempt to move the entire I18NDIR directory to 
  7467.  the specified target drive.  If successful the I18NDIR environment variable in 
  7468.  the config.sys file will be updated to reflect this and the original I18NDIR 
  7469.  directory will be deleted.  If unsuccessful, the config.sys will not be 
  7470.  updated and a disk full error will be returned to the caller. 
  7471.  
  7472.  
  7473. ΓòÉΓòÉΓòÉ 14.5. CONFIG.SYS Changes ΓòÉΓòÉΓòÉ
  7474.  
  7475.  Environment Variable Handling 
  7476.  
  7477.  I18NDIR        If the I18NDIR environment variable is not found, then add it 
  7478.                 as follows: 
  7479.  
  7480.                                       I18NDIR=x:\IBMI18N;
  7481.  
  7482.                                       where "x" is the drive letter specified by the calling
  7483.                                       application.  If no drive letter is specified, the boot
  7484.                                       drive is used.
  7485.  
  7486.                 If the I18NDIR environment variable is found, leave it alone 
  7487.                 unless the I18N directory has been changed due to a disk full 
  7488.                 error.  Then update it to reflect the new location of the 
  7489.                 I18NDIR directory. 
  7490.  
  7491.  LANG           Generally, the LANG environment variable should not require 
  7492.                 updating or setting. 
  7493.  
  7494.                 If a value for the LANG environment variable is specified by 
  7495.                 the caller, add the LANG environment variable if it does not 
  7496.                 exist. If the LANG environment variable already exists, update 
  7497.                 it to the value specified by the caller. 
  7498.  
  7499.                 If no value is specified by the caller for the LANG environment 
  7500.                 variable and either the variable is not defined in the 
  7501.                 config.sys or it is invalid in the config.sys, then a default 
  7502.                 locale will be determined.  The default locale is based on the 
  7503.                 system's country code and keyboard settings.  The LANG 
  7504.                 environment variable will be set to this default. 
  7505.  
  7506.                 The I18N initialization code computes a default locale based on 
  7507.                 the system's country code and code page settings. So, the LANG 
  7508.                 variable is not usually necessary.  It may be desirable to set 
  7509.                 LANG if the value for LANG was obtained from user input or in 
  7510.                 countries, such as Belgium, where multiple languages are 
  7511.                 frequently used on the same machine.  If set, LANG should be of 
  7512.                 the form xx_xx (e.q. en_US) without a code page suffix, since 
  7513.                 this will be determined from the current process code page. 
  7514.  
  7515.                 If either the value of LANG specified by the caller or the 
  7516.                 value for LANG already in the config.sys file is not of the 
  7517.                 format xx_xx, it will be modified to meet this format.  This is 
  7518.                 being done to ensure compatibility with Visual Age C++. 
  7519.  
  7520.  NLSPATH        No changes will be made to the config.sys file regarding the 
  7521.                 NLSPATH environment variable.  This variable is involved in the 
  7522.                 location of message files and this install program does NOT 
  7523.                 install any message files. 
  7524.  
  7525.                 The NLSPATH environment variable contains a LIST of paths. 
  7526.                 Therefore when updating it, products should add to the list, 
  7527.                 not replace the list. 
  7528.  
  7529.  LOCPATH        If the LOCPATH environment variable exists, the path to the 
  7530.                 I18N code will be added to the beginning of the LOCPATH list of 
  7531.                 paths unless it is already there. 
  7532.  
  7533.                 If the LOCPATH environment variable does not exist, add it. 
  7534.  
  7535.  LIBPATH        Add the I18N code path to the beginning of LIBPATH unless it is 
  7536.                 already there. 
  7537.  
  7538.  This program will NOT backup the config.sys file.  It assumes that the caller 
  7539.  will handle this. 
  7540.  
  7541.  
  7542. ΓòÉΓòÉΓòÉ 14.6. Syntax ΓòÉΓòÉΓòÉ
  7543.  
  7544.     i18ninst sourcepath DRIVE=x UPDCFG=x LANG=xx_xx ERASE=x CFGDRIVE=x
  7545.  
  7546.  
  7547. ΓòÉΓòÉΓòÉ 14.7. Parameters ΓòÉΓòÉΓòÉ
  7548.  
  7549.  sourcepath     Path containing code to be installed. This parameter is 
  7550.                 REQUIRED and must be the 1st parameter specified. 
  7551.  
  7552.                 If the path does not contain a drive letter, the current drive 
  7553.                 is used. 
  7554.  
  7555.                 This program expects to find the following UNPACKED files and 
  7556.                 directories at the specified path: 
  7557.  
  7558.                     SYSLEVEL.I18 file 
  7559.                     \DLL\SETLOC1.DLL 
  7560.                     \LOCALE\xxxxxxxx.DLL for each locale file. 
  7561.                     \LOCALE\ALIASES 
  7562.  
  7563.  DRIVE=x        Drive where code should be installed. 
  7564.  
  7565.                 If a version of the I18N code equal to or newer than this 
  7566.                 version is already installed, this program will install using 
  7567.                 the same drive as the already existing code and this parameter 
  7568.                 will be ignored. 
  7569.  
  7570.                 If the I18N code is not installed or an older version is 
  7571.                 already installed, this program will install the code on the 
  7572.                 drive specified in the directory, IBMI18N. 
  7573.  
  7574.                 This parameter is optional. 
  7575.  
  7576.                 If this parameter is not specified, the OS/2 install drive is 
  7577.                 used. 
  7578.  
  7579.  UPDCFG=x       This parameter specifies whether or not the config.sys file 
  7580.                 should be updated.  CONFIG=Y indicates that it should be 
  7581.                 updated.  CONFIG=N indicates that it should not. 
  7582.  
  7583.                 This parameter is optional.  If it is not specified, the 
  7584.                 default is CONFIG=Y. 
  7585.  
  7586.  LANG=xx_xx     This parameter specifies a value to set the LANG environment 
  7587.                 variable to.  The config.sys file is updated with this value if 
  7588.                 CONFIG=Y was specified. 
  7589.  
  7590.                 This parameter is optional.  If it is not specified, the 
  7591.                 config.sys file will be unchanged with regards to the LANG 
  7592.                 environment variable. 
  7593.  
  7594.  ERASE=x        This parameter specifies whether or not this install program 
  7595.                 should erase the caller's source files and directory when the 
  7596.                 installation successfully completes.  ERASE=Y indicates that 
  7597.                 the files and directory should be erase.  ERASE=N indicates 
  7598.                 they should not. 
  7599.  
  7600.                 This parameter is optional.  If it is not specified the default 
  7601.                 is 'N'. 
  7602.  
  7603.  CFGDRIVE=x     This parameter specifies the drive where the config.sys file is 
  7604.                 located.  This parameter is optional.  If it is not specified, 
  7605.                 the boot drive is assumed.  This parameter is ignored if 
  7606.                 UPDCFG=N is specified. 
  7607.  
  7608.  
  7609. ΓòÉΓòÉΓòÉ 14.8. Prerequisites ΓòÉΓòÉΓòÉ
  7610.  
  7611.  This program assumes that all source files are located in the following 
  7612. directory structure: 
  7613.  
  7614.      SYSLEVEL.I18 
  7615.      \DLL\SETLOC1.DLL 
  7616.      \LOCALE\locale DLL files 
  7617.      \LOCALE\ALIASES 
  7618.  
  7619.  This program assumes that ONLY the I18N files are in this directory.  Because 
  7620.  different products install different locale files and additional locale files 
  7621.  may still be added, this install program has no knowledge of the exact number 
  7622.  of files to expect or what the file names may be. 
  7623.  
  7624.  The config.sys file has already been backed up.