os/ossrv/genericopenlibs/openenvcore/include/wchar.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/** @file  ../include/wchar.h
sl@0
     2
@internalComponent
sl@0
     3
*/
sl@0
     4
sl@0
     5
/** @fn  btowc(int c)
sl@0
     6
@param c
sl@0
     7
sl@0
     8
Note: This description also covers the following functions -
sl@0
     9
 wctob() 
sl@0
    10
sl@0
    11
@return   The btowc function returns the wide character converted from the single 
sl@0
    12
  byte c . If c is EOF or not a valid multibyte sequence of length 1 the function 
sl@0
    13
  returns WEOF.
sl@0
    14
sl@0
    15
  The btowc function converts a single-byte character into a corresponding 
sl@0
    16
wide character. If the character is EOF , or not valid in the initial shift state, btowc returns WEOF.
sl@0
    17
sl@0
    18
 The wctob function converts a wide character into a corresponding single-byte 
sl@0
    19
  character. If the wide character is WEOF , or not able to be represented as a single byte in the initial 
sl@0
    20
  shift state, wctob returns WEOF.
sl@0
    21
sl@0
    22
 
sl@0
    23
sl@0
    24
Examples:
sl@0
    25
@code
sl@0
    26
#include <wchar.h>
sl@0
    27
// Illustrates how to use btowc API
sl@0
    28
wint_t example_btowc(int c)
sl@0
    29
{
sl@0
    30
 wint_t wc = L'a';
sl@0
    31
 //  converting single byte to wide-character 
sl@0
    32
 wc = btowc(c);
sl@0
    33
 // return the character that was converted 
sl@0
    34
return (wc);
sl@0
    35
}
sl@0
    36
sl@0
    37
@endcode
sl@0
    38
@code
sl@0
    39
#include <wchar.h>
sl@0
    40
/* Illustrates how to use wctob API */
sl@0
    41
int example_wctob(void)
sl@0
    42
{
sl@0
    43
 wint_t wc = L'a';
sl@0
    44
 int c;
sl@0
    45
  
sl@0
    46
 /* represent a wide-char in a single byte*/
sl@0
    47
 c = wctob(wc);
sl@0
    48
 /* return the single byte */
sl@0
    49
 return(c);
sl@0
    50
}
sl@0
    51
sl@0
    52
@endcode
sl@0
    53
sl@0
    54
Limitations:
sl@0
    55
sl@0
    56
The current implementation of btowc and wctob is not affected by the LC_CTYPE category of the current locale.
sl@0
    57
It works only for UTF8 character set.
sl@0
    58
sl@0
    59
@see mbrtowc()
sl@0
    60
@see wcrtomb()
sl@0
    61
sl@0
    62
sl@0
    63
 
sl@0
    64
sl@0
    65
@publishedAll
sl@0
    66
@externallyDefinedApi
sl@0
    67
*/
sl@0
    68
sl@0
    69
/** @fn  fgetwc(FILE *stream)
sl@0
    70
@param stream
sl@0
    71
sl@0
    72
Note: This description also covers the following functions -
sl@0
    73
 getwc()  getwchar() 
sl@0
    74
sl@0
    75
@return   If successful these routines return the next wide character from the stream. If the stream is at end-of-file or a read error occurs the routines 
sl@0
    76
return WEOF. The routines feof and ferror must be used to distinguish between end-of-file 
sl@0
    77
and error. If an error occurs the global variable errno is set to indicate the error. The end-of-file condition is remembered, 
sl@0
    78
even on a terminal, and all subsequent attempts to read will return WEOF until the condition is cleared with clearerr .
sl@0
    79
sl@0
    80
  The fgetwc function
sl@0
    81
obtains the next input wide character (if present) from the stream pointed at by stream, or the next character pushed back on the stream via ungetwc .
sl@0
    82
sl@0
    83
 The getwc function
sl@0
    84
acts essentially identical to fgetwc.
sl@0
    85
sl@0
    86
 The getwchar function
sl@0
    87
is equivalent to getwc with the argument stdin.
sl@0
    88
sl@0
    89
Examples:
sl@0
    90
@code
sl@0
    91
/* Illustrates how to use fgetwc API */
sl@0
    92
#include <stdio.h>
sl@0
    93
#include <wchar.h>
sl@0
    94
wint_t example_fgetwc(void)
sl@0
    95
{
sl@0
    96
 FILE *fp = NULL;
sl@0
    97
 wint_t retval;
sl@0
    98
 
sl@0
    99
 /* opening the input file */
sl@0
   100
 fp = fopen("input.txt","r");
sl@0
   101
 if(fp == NULL)
sl@0
   102
 {
sl@0
   103
  wprintf(L"Error: File open
sl@0
   104
");
sl@0
   105
  return (-1);
sl@0
   106
 }
sl@0
   107
 /* Read a character from the opened file */
sl@0
   108
 retval = fgetwc(fp);
sl@0
   109
 /* Close the file open for reading */
sl@0
   110
 fclose(fp);
sl@0
   111
 /* return the character read from the file */
sl@0
   112
 return (retval);
sl@0
   113
}
sl@0
   114
sl@0
   115
@endcode
sl@0
   116
@code
sl@0
   117
/* Illustrates how to use getwc API */
sl@0
   118
#include <stdio.h>
sl@0
   119
#include <wchar.h>
sl@0
   120
wint_t example_getwc(void)
sl@0
   121
{
sl@0
   122
 FILE *fp =  NULL;
sl@0
   123
 wint_t retval;
sl@0
   124
 
sl@0
   125
 /* opening the input file */
sl@0
   126
 fp = fopen("input.txt","r");
sl@0
   127
 if(fp == NULL)
sl@0
   128
 {
sl@0
   129
  wprintf(L"Error: File open
sl@0
   130
");
sl@0
   131
  return (-1);
sl@0
   132
 }
sl@0
   133
 /* Read a character from the opened file */
sl@0
   134
 retval = getwc(fp);
sl@0
   135
 /* Close the file open for reading */
sl@0
   136
 fclose(fp);
sl@0
   137
 /* return the character read from the file */
sl@0
   138
 return (retval);
sl@0
   139
}
sl@0
   140
sl@0
   141
@endcode
sl@0
   142
@code
sl@0
   143
/* Illustrates how to use getwchar API */
sl@0
   144
#include <stdio.h>
sl@0
   145
#include <wchar.h>
sl@0
   146
wint_t example_getwchar(void)
sl@0
   147
{
sl@0
   148
 wint_t retval;
sl@0
   149
 
sl@0
   150
 /* Read a character from standard input */
sl@0
   151
 retval = getwchar();
sl@0
   152
 /* return the character read */
sl@0
   153
 return (retval);
sl@0
   154
}
sl@0
   155
sl@0
   156
@endcode
sl@0
   157
@see ferror()
sl@0
   158
@see fopen()
sl@0
   159
@see fread()
sl@0
   160
@see getc()
sl@0
   161
@see putwc()
sl@0
   162
@see ungetwc()
sl@0
   163
sl@0
   164
sl@0
   165
 
sl@0
   166
sl@0
   167
@publishedAll
sl@0
   168
@externallyDefinedApi
sl@0
   169
*/
sl@0
   170
sl@0
   171
sl@0
   172
/** @fn  fgetws(wchar_t *  ws, int n, FILE *  fp)
sl@0
   173
@param ws
sl@0
   174
@param n
sl@0
   175
@param fp
sl@0
   176
@return   Upon successful completion fgetws returns ws. If end-of-file occurs before any characters are read, fgetws returns NULL and the buffer contents remain unchanged. If an error occurs fgetws returns NULL and the buffer contents are indeterminate. The fgetws function does not distinguish between end-of-file and error, 
sl@0
   177
and callers must use feof and ferror to determine which occurred.
sl@0
   178
sl@0
   179
  The fgetws function reads at most one less than the number of characters 
sl@0
   180
specified by n from the given fp and stores them in the wide character string ws. Reading stops when a newline character is found, at end-of-file or 
sl@0
   181
error. The newline, if any, is retained. If any characters are read, and there 
sl@0
   182
is no error, a '\\0' character is appended to end the string.
sl@0
   183
sl@0
   184
Examples:
sl@0
   185
@code
sl@0
   186
#include <stdio.h>
sl@0
   187
#include <wchar.h>
sl@0
   188
/* Illustrates how to use fgetws API */
sl@0
   189
wchar_t *example_fgetws(wchar_t *buf)
sl@0
   190
{
sl@0
   191
 FILE *fp = NULL;
sl@0
   192
 wint_t retval;
sl@0
   193
 int n;
sl@0
   194
 /* for example, 10 characters to be read */
sl@0
   195
 n = 10;
sl@0
   196
 /* opening the input file */
sl@0
   197
 fp = fopen("input.txt","r");
sl@0
   198
 if(fp == NULL)
sl@0
   199
 {
sl@0
   200
  wprintf(L"Error: File open
sl@0
   201
");
sl@0
   202
  return (-1);
sl@0
   203
 }
sl@0
   204
 /* Read characters from the opened file */
sl@0
   205
 retval = fgetws(buf, n, fp);
sl@0
   206
 /* Close the file open for reading */
sl@0
   207
 fclose(fp);
sl@0
   208
 /* return the character read from the file */
sl@0
   209
 return (buf);
sl@0
   210
}
sl@0
   211
sl@0
   212
@endcode
sl@0
   213
@see feof()
sl@0
   214
@see ferror()
sl@0
   215
@see fgets()
sl@0
   216
sl@0
   217
sl@0
   218
 
sl@0
   219
sl@0
   220
@publishedAll
sl@0
   221
@externallyDefinedApi
sl@0
   222
*/
sl@0
   223
sl@0
   224
/** @fn  fputwc(wchar_t wc, FILE *stream)
sl@0
   225
@param wc
sl@0
   226
@param stream
sl@0
   227
sl@0
   228
Note: This description also covers the following functions -
sl@0
   229
 putwc()  putwchar() 
sl@0
   230
sl@0
   231
@return   The fputwc, putwc, and putwchar functions
sl@0
   232
return the wide character written.
sl@0
   233
If an error occurs, the value WEOF is returned.
sl@0
   234
sl@0
   235
  The fputwc function
sl@0
   236
writes the wide character wc to the output stream pointed to by stream.
sl@0
   237
sl@0
   238
 The putwc function
sl@0
   239
acts essentially identically to fputwc.
sl@0
   240
sl@0
   241
 The putwchar function
sl@0
   242
is identical to putwc with an output stream of stdout.
sl@0
   243
sl@0
   244
Examples:
sl@0
   245
@code
sl@0
   246
/* Illustrates how to use putwc API */
sl@0
   247
#include <stdio.h>
sl@0
   248
#include <wchar.h>
sl@0
   249
wint_t example_putwc(void)
sl@0
   250
{
sl@0
   251
 FILE *fp = NULL;
sl@0
   252
 wchar_t wc = L'a';
sl@0
   253
 wint_t rval;
sl@0
   254
 /* opening the file to write*/
sl@0
   255
 fp = fopen("input.txt","w");
sl@0
   256
 if(fp == NULL)
sl@0
   257
 {
sl@0
   258
  wprintf(L"Error: File open
sl@0
   259
");
sl@0
   260
  return (-1);
sl@0
   261
 }
sl@0
   262
/* write a character into fp */
sl@0
   263
 rval = putwc(wc, fp);
sl@0
   264
 /* Close the file opened for writing */
sl@0
   265
 fclose(fp);
sl@0
   266
 /* return the value that was written */
sl@0
   267
 return (rval);
sl@0
   268
}
sl@0
   269
sl@0
   270
@endcode
sl@0
   271
@code
sl@0
   272
/* Illustrates how to use fputwc API */
sl@0
   273
#include <stdio.h>
sl@0
   274
#include <wchar.h>
sl@0
   275
wint_t example_fputwc(void)
sl@0
   276
{
sl@0
   277
 FILE *fp = NULL;
sl@0
   278
 wchar_t wc = L'a';
sl@0
   279
 wint_t rval;
sl@0
   280
 /* opening the file to write*/
sl@0
   281
 fp = fopen("input.txt","w");
sl@0
   282
 if(fp == NULL)
sl@0
   283
 {
sl@0
   284
  wprintf(L"Error: File open
sl@0
   285
");
sl@0
   286
  return (-1);
sl@0
   287
 }
sl@0
   288
/* write a character into fp */
sl@0
   289
 rval = fputwc(wc, fp);
sl@0
   290
 /* Close the file opened for writing */
sl@0
   291
 fclose(fp);
sl@0
   292
 /* return the value that was written */
sl@0
   293
 return (rval);
sl@0
   294
}
sl@0
   295
sl@0
   296
@endcode
sl@0
   297
@code
sl@0
   298
/* Illustrates how to use putwchar API */
sl@0
   299
#include <stdio.h>
sl@0
   300
#include <wchar.h>
sl@0
   301
wint_t example_putwchar(void)
sl@0
   302
{
sl@0
   303
 wint_t rval;
sl@0
   304
 wchar_t wc = L'q';
sl@0
   305
 
sl@0
   306
 /* write a character onto the standard output */
sl@0
   307
 rval = putwchar(wc);
sl@0
   308
 /* return the character that was written */
sl@0
   309
 return (rval);
sl@0
   310
}
sl@0
   311
sl@0
   312
@endcode
sl@0
   313
 Output of putwchar
sl@0
   314
@code
sl@0
   315
q
sl@0
   316
sl@0
   317
@endcode
sl@0
   318
@see ferror()
sl@0
   319
@see fopen()
sl@0
   320
@see getwc()
sl@0
   321
@see putc()
sl@0
   322
sl@0
   323
sl@0
   324
 
sl@0
   325
sl@0
   326
@publishedAll
sl@0
   327
@externallyDefinedApi
sl@0
   328
*/
sl@0
   329
sl@0
   330
sl@0
   331
/** @fn  fputws(const wchar_t *  ws, FILE *  fp)
sl@0
   332
@param ws
sl@0
   333
@param fp
sl@0
   334
@return   The fputws function
sl@0
   335
returns 0 on success and -1 on error.
sl@0
   336
sl@0
   337
  The fputws function writes the wide character string pointed to by ws to the stream pointed to by fp.
sl@0
   338
sl@0
   339
Examples:
sl@0
   340
@code
sl@0
   341
#include <stdio.h>
sl@0
   342
#include <wchar.h>
sl@0
   343
/* Illustrates how to use fputws API */
sl@0
   344
int example_fputws(wchar_t *buf)
sl@0
   345
{
sl@0
   346
 FILE *fp = NULL;
sl@0
   347
 int retval;
sl@0
   348
 /* open the file for writing*/
sl@0
   349
 fp = fopen("write.txt","r");
sl@0
   350
 if(fp == NULL)
sl@0
   351
 {
sl@0
   352
  wprintf(L"Error: File open
sl@0
   353
");
sl@0
   354
  return (-1);
sl@0
   355
 }
sl@0
   356
 /* Write the characters into the file */
sl@0
   357
 retval = fputws(buf, fp);
sl@0
   358
 /* Close the file open for writing */
sl@0
   359
 fclose(fp);
sl@0
   360
 /* return the number of characters written */
sl@0
   361
 /* into the file */
sl@0
   362
 return (retval);
sl@0
   363
}
sl@0
   364
sl@0
   365
@endcode
sl@0
   366
@see ferror()
sl@0
   367
@see fputs()
sl@0
   368
@see putwc()
sl@0
   369
sl@0
   370
sl@0
   371
 
sl@0
   372
sl@0
   373
@publishedAll
sl@0
   374
@externallyDefinedApi
sl@0
   375
*/
sl@0
   376
sl@0
   377
sl@0
   378
/** @fn  fwide(FILE *stream, int mode)
sl@0
   379
@param stream
sl@0
   380
@param mode
sl@0
   381
@return   The fwide function
sl@0
   382
returns a value according to orientation after the call of fwide; a value less than zero if byte-oriented, a value greater than zero
sl@0
   383
if wide-oriented, and zero if the stream has no orientation.
sl@0
   384
sl@0
   385
  The fwide function
sl@0
   386
determines the orientation of the stream pointed at by stream.
sl@0
   387
sl@0
   388
 If the orientation of stream has already been determined fwide leaves it unchanged. Otherwise fwide sets the orientation of stream according to mode.
sl@0
   389
sl@0
   390
 If mode is less than zero stream is set to byte-oriented. If it is greater than zero stream is set to wide-oriented. Otherwise mode is zero and stream is unchanged.
sl@0
   391
sl@0
   392
Examples:
sl@0
   393
@code
sl@0
   394
#include <stdio.h>
sl@0
   395
#include <wchar.h>
sl@0
   396
/* Illustrates how to use fwide API */
sl@0
   397
int example_fwide(void)
sl@0
   398
{
sl@0
   399
 FILE *fp = NULL;
sl@0
   400
 int retval;
sl@0
   401
 int mode;
sl@0
   402
 /* open a file */
sl@0
   403
 fp = fopen("input.txt","r");
sl@0
   404
 if(fp == NULL)
sl@0
   405
 {
sl@0
   406
  wprintf(L"Error: File open
sl@0
   407
");
sl@0
   408
  return (-1);
sl@0
   409
 }
sl@0
   410
 /* set the mode to wide*/
sl@0
   411
 mode = 1;
sl@0
   412
 /* set the orientation of the file */
sl@0
   413
 retval = fwide(fp, mode);
sl@0
   414
 /*     check   the     return value */
sl@0
   415
 if(retval ==   1)
sl@0
   416
 {
sl@0
   417
        wprintf(L"Mode set to WIDE
sl@0
   418
");
sl@0
   419
 }
sl@0
   420
 else
sl@0
   421
 {
sl@0
   422
        wprintf(L"Error setting the mode to wide!!
sl@0
   423
");
sl@0
   424
 }
sl@0
   425
 /* set the mode to determine the orientation */
sl@0
   426
 mode = 0;
sl@0
   427
 /* Read back the orientation that was set */
sl@0
   428
 retval = fwide(fp ,mode);
sl@0
   429
 if(retval == 1)
sl@0
   430
 {
sl@0
   431
        wprintf("Mode not changed
sl@0
   432
");
sl@0
   433
 }
sl@0
   434
 else
sl@0
   435
 {
sl@0
   436
        wprintf("Error, mode changed!!
sl@0
   437
");
sl@0
   438
 }
sl@0
   439
 /* Close the file open for writing */
sl@0
   440
 fclose(fp);
sl@0
   441
 /* return the mode of fp */
sl@0
   442
 return (retval);
sl@0
   443
}
sl@0
   444
sl@0
   445
@endcode
sl@0
   446
@see ferror()
sl@0
   447
@see fgetc()
sl@0
   448
@see fgetwc()
sl@0
   449
@see fopen()
sl@0
   450
@see fputc()
sl@0
   451
@see fputwc()
sl@0
   452
@see freopen()
sl@0
   453
sl@0
   454
sl@0
   455
 
sl@0
   456
sl@0
   457
@publishedAll
sl@0
   458
@externallyDefinedApi
sl@0
   459
*/
sl@0
   460
sl@0
   461
sl@0
   462
/** @fn  fwprintf(FILE *  stream, const wchar_t *  format, ...)
sl@0
   463
@param stream
sl@0
   464
@param format
sl@0
   465
@param ...
sl@0
   466
sl@0
   467
Note: This description also covers the following functions -
sl@0
   468
 swprintf()  snwprintf()  vsnwprintf()  wprintf()  vfwprintf()  vswprintf()  vwprintf() 
sl@0
   469
sl@0
   470
@return   The functions return the number of wide characters written, excluding the terminating null wide character in case of the functions swprintf , snwprintf , vswprintf and vsnwprintf . They return -1 when an error occurs.
sl@0
   471
sl@0
   472
The wprintf family of functions produces output according to a format as described below. The wprintf and vwprintf functions write output to stdout, the standard output stream; fwprintf and vfwprintf write output to the given output stream; swprintf , snwprintf , vswprintf and vsnwprintf write to the wide character string ws. 
sl@0
   473
These functions write the output under the control of a format string that specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities of stdarg) are converted for output. 
sl@0
   474
sl@0
   475
These functions return the number of characters printed (not including the trailing ‘\\0’ used to end output to strings). 
sl@0
   476
sl@0
   477
The swprintf , snwprintf , vswprintf and vsnwprintf functions will fail if n or more wide characters were requested to be written. 
sl@0
   478
sl@0
   479
@code
sl@0
   480
sl@0
   481
Note : 
sl@0
   482
sl@0
   483
1. swprintf and snwprintf can be used interchangeably. 
sl@0
   484
sl@0
   485
2. vswprintf and vsnwprintf can be used interchangeably. 
sl@0
   486
sl@0
   487
sl@0
   488
The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the % character. The arguments must correspond properly (after type promotion) with the conversion specifier. After the %, the following appear in sequence: 
sl@0
   489
@endcode
sl@0
   490
sl@0
   491
@code
sl@0
   492
An optional field, consisting of a decimal digit string followed by a $, specifying the next argument to access. If this field is not provided, the argument following the last argument accessed will be used. Arguments are numbered starting at 1. If unaccessed arguments in the format string are interspersed with ones that are accessed the results will be indeterminate. 
sl@0
   493
Zero or more of the following flags:
sl@0
   494
sl@0
   495
 '#'  The value should be converted to an "alternate form". For c, d, i, n, p, s, and u conversions, this option has no effect. For o conversions, the precision of the number is increased to force the first character of the output string to a zero (except if a zero value is printed with an explicit precision of zero). For x and X conversions, a non-zero result has the string ‘0x’ (or ‘0X’ for X conversions) prepended to it. For a, A, e, E, f, F, g, and G conversions, the result will always contain a decimal point, even if no digits follow it (normally, a decimal point appears in the results of those conversions only if a digit follows). For g and G conversions, trailing zeros are not removed from the result as they would otherwise be.  
sl@0
   496
sl@0
   497
'0(zero)'  Zero padding. For all conversions except n, the converted value is padded on the left with zeros rather than blanks. If a precision is given with a numeric conversion ( d, i, o, u, i, x, and X), the 0 flag is ignored.  
sl@0
   498
sl@0
   499
'-'  A negative field width flag; the converted value is to be left adjusted on the field boundary. Except for n conversions, the converted value is padded on the right with blanks, rather than on the left with blanks or zeros. A - overrides a 0 if both are given.  
sl@0
   500
sl@0
   501
' (space)'  A blank should be left before a positive number produced by a signed conversion ( a, A, d, e, E, f, F, g, G, or i).  
sl@0
   502
sl@0
   503
'+'  A sign must always be placed before a number produced by a signed conversion. A + overrides a space if both are used.  
sl@0
   504
sl@0
   505
'’'  Decimal conversions ( d, u, or i) or the integral portion of a floating point conversion ( f or F) should be grouped and separated by thousands using the non-monetary separator returned by localeconv.  
sl@0
   506
sl@0
   507
sl@0
   508
An optional decimal digit string specifying a minimum field width. If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the left-adjustment flag has been given) to fill out the field width. 
sl@0
   509
sl@0
   510
An optional precision, in the form of a period . followed by an optional digit string. If the digit string is omitted, the precision is taken as zero. This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point for a, A, e, E, f, and F conversions, the maximum number of significant digits for g and G conversions, or the maximum number of characters to be printed from a string for s conversions. 
sl@0
   511
sl@0
   512
An optional length modifier, that specifies the size of the argument. The following length modifiers are valid for the d, i, n, o, u, x, or X conversion:
sl@0
   513
sl@0
   514
@endcode
sl@0
   515
sl@0
   516
@code
sl@0
   517
sl@0
   518
 Modifier            d, i      o, u, x, X        n 
sl@0
   519
sl@0
   520
 hh signed char unsigned char signed char *
sl@0
   521
 h short unsigned short short *
sl@0
   522
 l (ell) long unsigned long long *
sl@0
   523
 ll (ell ell) long long unsigned long long long long *
sl@0
   524
 j intmax_t uintmax_t intmax_t *
sl@0
   525
 t ptrdiff_t (see note) ptrdiff_t *
sl@0
   526
 z (see note) size_t (see note)
sl@0
   527
 q (deprecated) quad_t u_quad_t quad_t *
sl@0
   528
sl@0
   529
@endcode
sl@0
   530
sl@0
   531
@code
sl@0
   532
sl@0
   533
Note: the t modifier, when applied to a o, u, x, or X conversion, indicates that the argument is of an unsigned type equivalent in size to a ptrdiff_t . The z modifier, when applied to a d or i conversion, indicates that the argument is of a signed type equivalent in size to a size_t . Similarly, when applied to an n conversion, it indicates that the argument is a pointer to a signed type equivalent in size to a size_t . 
sl@0
   534
sl@0
   535
The following length modifier is valid for the a, A, e, E, f, F, g, or G conversion:
sl@0
   536
sl@0
   537
@endcode
sl@0
   538
sl@0
   539
@code
sl@0
   540
sl@0
   541
 Modifier a, A, e, E, f, F, g, G
sl@0
   542
 L long double
sl@0
   543
sl@0
   544
@endcode
sl@0
   545
sl@0
   546
@code   
sl@0
   547
sl@0
   548
The following length modifier is valid for the c or s conversion:
sl@0
   549
sl@0
   550
Modifier c s
sl@0
   551
 l (ell) wint_t  wchar_t * 
sl@0
   552
sl@0
   553
@endcode
sl@0
   554
sl@0
   555
@code
sl@0
   556
sl@0
   557
A character that specifies the type of conversion to be applied. 
sl@0
   558
sl@0
   559
A field width or precision, or both, may be indicated by an asterisk ‘*’ or an asterisk followed by one or more decimal digits and a ‘$’ instead of a digit string. In this case, an int argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. If a single format directive mixes positional (nn$) and non-positional arguments, the results are undefined. 
sl@0
   560
sl@0
   561
The conversion specifiers and their meanings are: 
sl@0
   562
sl@0
   563
sl@0
   564
diouxX  
sl@0
   565
  The int (or appropriate variant) argument is converted to signed decimal ( d and i), unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal ( x and X) notation. The letters "abcdef" are used for x conversions; the letters "ABCDEF" are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros.  
sl@0
   566
sl@0
   567
DOU  
sl@0
   568
  The long int argument is converted to signed decimal, unsigned octal, or unsigned decimal, as if the format had been ld, lo, or lu respectively. These conversion characters are deprecated, and will eventually disappear.  
sl@0
   569
sl@0
   570
eE  
sl@0
   571
  The double argument is rounded and converted in the style [-d . ddd e \*[Pm] dd] where there is one digit before the decimal-point character and the number of digits after it is equal to the precision; if the precision is missing, it is taken as 6; if the precision is zero, no decimal-point character appears. An E conversion uses the letter ‘E’ (rather than ‘e’) to introduce the exponent. The exponent always contains at least two digits; if the value is zero, the exponent is 00. 
sl@0
   572
For a, A, e, E, f, F, g, and G conversions, positive and negative infinity are represented as inf and -inf respectively when using the lowercase conversion character, and INF and -INF respectively when using the uppercase conversion character. Similarly, NaN is represented as nan when using the lowercase conversion, and NAN when using the uppercase conversion. 
sl@0
   573
 
sl@0
   574
fF  
sl@0
   575
  The double argument is rounded and converted to decimal notation in the style [-ddd . ddd], where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly zero, no decimal-point character appears. If a decimal point appears, at least one digit appears before it.  
sl@0
   576
sl@0
   577
gG  The double argument is converted in style f or e (or F or E for G conversions). The precision specifies the number of significant digits. If the precision is missing, 6 digits are given; if the precision is zero, it is treated as 1. Style e is used if the exponent from its conversion is less than -4 or greater than or equal to the precision. Trailing zeros are removed from the fractional part of the result; a decimal point appears only if it is followed by at least one digit.  
sl@0
   578
sl@0
   579
aA  The double argument is converted to hexadecimal notation in the style [-0x h . hhhp[\*[Pm]d]], where the number of digits after the hexadecimal-point character is equal to the precision specification. If the precision is missing, it is taken as enough to exactly represent the floating-point number; if the precision is explicitly zero, no hexadecimal-point character appears. This is an exact conversion of the mantissa+exponent internal floating point representation; the [-0x h . hhh] portion represents exactly the mantissa; only denormalized mantissas have a zero value to the left of the hexadecimal point. The p is a literal character ‘p’; the exponent is preceded by a positive or negative sign and is represented in decimal, using only enough characters to represent the exponent. The A conversion uses the prefix "0X" (rather than "0x"), the letters "ABCDEF" (rather than "abcdef") to represent the hex digits, and the letter ‘P’ (rather than ‘p’) to separate the mantissa and exponent.  
sl@0
   580
sl@0
   581
C  Treated as c with the l (ell) modifier.  
sl@0
   582
sl@0
   583
c  The int argument is converted to an unsigned char , then to a wchar_t as if by btowc, and the resulting character is written. 
sl@0
   584
sl@0
   585
If the l (ell) modifier is used, the wint_t argument is converted to a wchar_t and written. 
sl@0
   586
 
sl@0
   587
S  Treated as s with the l (ell) modifier.  
sl@0
   588
sl@0
   589
s  The char * argument is expected to be a pointer to an array of character type (pointer to a string) containing a multibyte sequence. Characters from the array are converted to wide characters and written up to (but not including) a terminating NUL character; if a precision is specified, no more than the number specified are written. If a precision is given, no null character need be present; if the precision is not specified, or is greater than the size of the array, the array must contain a terminating NUL character. 
sl@0
   590
sl@0
   591
If the l (ell) modifier is used, the wchar_t * argument is expected to be a pointer to an array of wide characters (pointer to a wide string). Each wide character in the string is written. Wide characters from the array are written up to (but not including) a terminating wide NUL character; if a precision is specified, no more than the number specified are written (including shift sequences). If a precision is given, no null character need be present; if the precision is not specified, or is greater than the number of characters in the string, the array must contain a terminating wide NUL character. 
sl@0
   592
 
sl@0
   593
p  The void * pointer argument is printed in hexadecimal (as if by ‘%#x’ or ‘%#lx’).  
sl@0
   594
sl@0
   595
n  The number of characters written so far is stored into the integer indicated by the int * (or variant) pointer argument. No argument is converted. 
sl@0
   596
 
sl@0
   597
%  A ‘%’ is written. No argument is converted. The complete conversion specification is ‘%%’.  
sl@0
   598
sl@0
   599
@endcode
sl@0
   600
sl@0
   601
The decimal point character is defined in the program’s locale (category LC_NUMERIC). 
sl@0
   602
sl@0
   603
In no case does a non-existent or small field width cause truncation of a numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. 
sl@0
   604
sl@0
   605
sl@0
   606
Examples:
sl@0
   607
@code
sl@0
   608
#include <stdio.h>
sl@0
   609
#include <wchar.h>
sl@0
   610
/* Illustrates how to use wprintf API */
sl@0
   611
int example_wprintf(void)
sl@0
   612
{
sl@0
   613
 int input = 12345;
sl@0
   614
 int rval;
sl@0
   615
 /* prints the integers on the standard output */
sl@0
   616
 rval = wprintf(L"%d", input);
sl@0
   617
 /* return the number of wide characters that were written */
sl@0
   618
 return(rval);
sl@0
   619
}
sl@0
   620
sl@0
   621
@endcode
sl@0
   622
 Output
sl@0
   623
@code
sl@0
   624
12345
sl@0
   625
sl@0
   626
@endcode
sl@0
   627
@code
sl@0
   628
#include <stdio.h>
sl@0
   629
#include <wchar.h>
sl@0
   630
/* Illustrates how to use fwprintf API */
sl@0
   631
int example_fwprintf(void)
sl@0
   632
{
sl@0
   633
 FILE *fp = NULL;
sl@0
   634
 int retval;
sl@0
   635
 wchar_t *wcs = L"abc";
sl@0
   636
 /* open the file for writing*/
sl@0
   637
 fp = fopen("write.txt","w");
sl@0
   638
 if(fp == NULL)
sl@0
   639
 {
sl@0
   640
  wprintf(L"Error: File open
sl@0
   641
");
sl@0
   642
  return (-1);
sl@0
   643
 }
sl@0
   644
 /* print the characters into the file */
sl@0
   645
 retval = fwprintf(fp, L"%s", wcs);
sl@0
   646
 /* Close the file opened for writing */
sl@0
   647
 fclose(fp);
sl@0
   648
 /* return the number of wide characters that were written */
sl@0
   649
 return (retval);
sl@0
   650
}
sl@0
   651
sl@0
   652
@endcode
sl@0
   653
@code
sl@0
   654
#include <stdio.h>
sl@0
   655
#include <wchar.h>
sl@0
   656
/* Illustrates how to use swprintf API */
sl@0
   657
int example_swprintf(wchar_t *buf, int maxlen)
sl@0
   658
{
sl@0
   659
 wchar_t *wcs = L"abcdef";
sl@0
   660
 int rval;
sl@0
   661
 /* prints the wide char string into the buffer buf */
sl@0
   662
 rval = swprintf(buf, maxlen, L"%s", wcs);
sl@0
   663
 /* return the number of wide characters that were written */
sl@0
   664
 return(rval);
sl@0
   665
}
sl@0
   666
sl@0
   667
@endcode
sl@0
   668
@code
sl@0
   669
#include <stdio.h>
sl@0
   670
#include <wchar.h>
sl@0
   671
/* Illustrates how to use vwprintf API */
sl@0
   672
int example_vwprintf(va_list input)
sl@0
   673
{
sl@0
   674
 int rval;
sl@0
   675
 /* prints the integers on the standard output */
sl@0
   676
 rval = vwprintf(L"%d", input);
sl@0
   677
 /* return the number of wide characters that were written */
sl@0
   678
 return(rval);
sl@0
   679
}
sl@0
   680
sl@0
   681
@endcode
sl@0
   682
@code
sl@0
   683
#include <stdio.h>
sl@0
   684
#include <wchar.h>
sl@0
   685
/* Illustrates how to use vfwprintf API */
sl@0
   686
int example_vfwprintf(va_list input)
sl@0
   687
{
sl@0
   688
  FILE *fp = NULL;
sl@0
   689
  int retval;
sl@0
   690
 
sl@0
   691
  /* open the file for writing*/
sl@0
   692
  fp = fopen("write.txt","w");
sl@0
   693
  if(fp == NULL)
sl@0
   694
  {
sl@0
   695
    wprintf(L"Error: File open
sl@0
   696
");
sl@0
   697
    return (-1);
sl@0
   698
  }
sl@0
   699
  /* print the characters into the file */
sl@0
   700
  retval = vfwprintf(fp, L"%s", input);
sl@0
   701
  /* Close the file opened for writing */
sl@0
   702
  fclose(fp);
sl@0
   703
  /* return the number of wide characters that were written */
sl@0
   704
  return (retval);
sl@0
   705
}
sl@0
   706
sl@0
   707
@endcode
sl@0
   708
@code
sl@0
   709
#include <stdio.h>
sl@0
   710
#include <wchar.h>
sl@0
   711
/* Illustrates how to use vswprintf API */
sl@0
   712
int example_vswprintf(wchar_t *buf, int maxlen, va_list input)
sl@0
   713
{
sl@0
   714
 int rval;
sl@0
   715
 /* prints the wide char string into the buffer buf */
sl@0
   716
 rval = vswprintf(buf, maxlen, L"%s", input);
sl@0
   717
 /* return the number of wide characters that were written */
sl@0
   718
 return(rval);
sl@0
   719
}
sl@0
   720
sl@0
   721
@endcode
sl@0
   722
sl@0
   723
Security considerations:
sl@0
   724
sl@0
   725
Refer to printf() .
sl@0
   726
 
sl@0
   727
Limitations:
sl@0
   728
sl@0
   729
Long double length modifiers are not supported. The maximum floating point 
sl@0
   730
precision is 15 digits.
sl@0
   731
sl@0
   732
@see btowc()
sl@0
   733
@see fputws()
sl@0
   734
@see printf()
sl@0
   735
@see putwc()
sl@0
   736
@see setlocale()
sl@0
   737
@see wcsrtombs()
sl@0
   738
@see wscanf()
sl@0
   739
sl@0
   740
sl@0
   741
 
sl@0
   742
sl@0
   743
@publishedAll
sl@0
   744
@externallyDefinedApi
sl@0
   745
*/
sl@0
   746
sl@0
   747
/** @fn  fwscanf(FILE *  stream, const wchar_t *  format, ...)
sl@0
   748
@param stream
sl@0
   749
@param format
sl@0
   750
@param ...
sl@0
   751
sl@0
   752
Refer to wscanf() for the documentation
sl@0
   753
sl@0
   754
@see fgetwc()
sl@0
   755
@see scanf()
sl@0
   756
@see wcrtomb()
sl@0
   757
@see wcstod()
sl@0
   758
@see wcstol()
sl@0
   759
@see wcstoul()
sl@0
   760
@see wprintf()
sl@0
   761
sl@0
   762
sl@0
   763
 
sl@0
   764
sl@0
   765
@publishedAll
sl@0
   766
@externallyDefinedApi
sl@0
   767
*/
sl@0
   768
sl@0
   769
/** @fn  getwc(FILE *stream)
sl@0
   770
@param stream
sl@0
   771
sl@0
   772
Refer to  fgetwc() for the documentation
sl@0
   773
sl@0
   774
@see ferror()
sl@0
   775
@see fopen()
sl@0
   776
@see fread()
sl@0
   777
@see getc()
sl@0
   778
@see putwc()
sl@0
   779
@see ungetwc()
sl@0
   780
sl@0
   781
sl@0
   782
 
sl@0
   783
sl@0
   784
@publishedAll
sl@0
   785
@externallyDefinedApi
sl@0
   786
*/
sl@0
   787
sl@0
   788
sl@0
   789
/** @fn  getwchar(void)
sl@0
   790
sl@0
   791
Refer to fgetwc() for the documentation
sl@0
   792
sl@0
   793
@see ferror()
sl@0
   794
@see fopen()
sl@0
   795
@see fread()
sl@0
   796
@see getc()
sl@0
   797
@see putwc()
sl@0
   798
@see ungetwc()
sl@0
   799
sl@0
   800
sl@0
   801
 
sl@0
   802
sl@0
   803
@publishedAll
sl@0
   804
@externallyDefinedApi
sl@0
   805
*/
sl@0
   806
sl@0
   807
/** @fn  mbrlen(const char *  s, size_t n, mbstate_t *  ps)
sl@0
   808
@param s
sl@0
   809
@param n
sl@0
   810
@param ps
sl@0
   811
sl@0
   812
@return   The mbrlen functions returns: 0 The next n or fewer bytes
sl@0
   813
represent the null wide character (L'\\0') \>0 The next n or fewer bytes
sl@0
   814
represent a valid character, mbrlen returns the number of bytes used to complete the multibyte character. ( size_t-2)   The next n contribute to, but do not complete, a valid multibyte character sequence,
sl@0
   815
and all n bytes have been processed. ( size_t-1)   An encoding error has occurred.
sl@0
   816
The next n or fewer bytes do not contribute to a valid multibyte character.
sl@0
   817
sl@0
   818
  The mbrlen function inspects at most n bytes pointed to by s to determine the number of bytes needed to complete the next
sl@0
   819
multibyte character.
sl@0
   820
sl@0
   821
 The mbstate_t
sl@0
   822
argument, ps, is used to keep track of the shift state.
sl@0
   823
If it is NULL, mbrlen uses an internal, static mbstate_t
sl@0
   824
object, which is initialized to the initial conversion state
sl@0
   825
at program startup.
sl@0
   826
sl@0
   827
 It is equivalent to:
sl@0
   828
sl@0
   829
@code
sl@0
   830
sl@0
   831
mbrtowc(NULL, s, n, ps); 
sl@0
   832
sl@0
   833
@endcode
sl@0
   834
sl@0
   835
Except that when ps is a NULL pointer, mbrlen uses its own static, internal mbstate_t
sl@0
   836
object to keep track of the shift state. The behavior of the mbrlen is affected by LC_CTYPE category of the current locale.
sl@0
   837
sl@0
   838
Examples:
sl@0
   839
 A function that calculates the number of characters in a multibyte
sl@0
   840
character string:
sl@0
   841
@code
sl@0
   842
size_t
sl@0
   843
nchars(const char *s)
sl@0
   844
{
sl@0
   845
        size_t charlen, chars;
sl@0
   846
        mbstate_t mbs;
sl@0
   847
        chars = 0;
sl@0
   848
        memset(&mbs;, 0, sizeof(mbs));
sl@0
   849
        while ((charlen = mbrlen(s, MB_CUR_MAX, &mbs;)) != 0 &&
sl@0
   850
            charlen != (size_t)-1 && charlen != (size_t)-2) {
sl@0
   851
                s += charlen;
sl@0
   852
                chars++;
sl@0
   853
        }
sl@0
   854
        return (chars);
sl@0
   855
}
sl@0
   856
sl@0
   857
@endcode
sl@0
   858
sl@0
   859
Errors:
sl@0
   860
sl@0
   861
The mbrlen function will fail if: 
sl@0
   862
[EILSEQ] An invalid multibyte sequence was detected.  
sl@0
   863
[EINVAL] The conversion state is invalid.
sl@0
   864
sl@0
   865
Limitations:
sl@0
   866
sl@0
   867
The current implementation of mbrlen is not affected by the LC_CTYPE category of the current locale.
sl@0
   868
It works only for UTF8 character set.
sl@0
   869
sl@0
   870
@see mblen()
sl@0
   871
@see mbrtowc()
sl@0
   872
sl@0
   873
sl@0
   874
 
sl@0
   875
sl@0
   876
@publishedAll
sl@0
   877
@externallyDefinedApi
sl@0
   878
*/
sl@0
   879
sl@0
   880
/** @fn  mbrtowc(wchar_t *  pwc, const char *  s, size_t n, mbstate_t *  ps)
sl@0
   881
@param pwc
sl@0
   882
@param s
sl@0
   883
@param n
sl@0
   884
@param ps
sl@0
   885
sl@0
   886
@return   The mbrtowc functions returns: 0 The next n or fewer bytes
sl@0
   887
represent the null wide character (L'\\0') \>0 The next n or fewer bytes
sl@0
   888
represent a valid character, mbrtowc returns the number of bytes used to complete the multibyte character. ( size_t-2)   The next n contribute to, but do not complete, a valid multibyte character sequence,
sl@0
   889
and all n bytes have been processed. ( size_t-1)   An encoding error has occurred.
sl@0
   890
The next n or fewer bytes do not contribute to a valid multibyte character.
sl@0
   891
sl@0
   892
sl@0
   893
  The mbrtowc function inspects at most n bytes pointed to by s to determine the number of bytes needed to complete the next multibyte
sl@0
   894
character.
sl@0
   895
If a character can be completed, and pwc is not NULL, the wide character which is represented by s is stored in the wchar_t
sl@0
   896
it points to.
sl@0
   897
sl@0
   898
 If s is NULL, mbrtowc behaves as if pwc was NULL, s was an empty string ("")
sl@0
   899
and n was 1.
sl@0
   900
sl@0
   901
 The mbstate_t
sl@0
   902
argument, ps, is used to keep track of the shift state.
sl@0
   903
If it is NULL, mbrtowc uses an internal, static mbstate_t
sl@0
   904
object, which is initialized to the initial conversion state
sl@0
   905
at program startup.
sl@0
   906
sl@0
   907
 The behavior of the mbrtowc is affected by LC_CTYPE category of the current locale.
sl@0
   908
sl@0
   909
Examples:
sl@0
   910
@code
sl@0
   911
#include <stdio.h>
sl@0
   912
#include <stdlib.h>
sl@0
   913
#include <wchar.h>
sl@0
   914
/* Illustrates how to use mbrtowc API */
sl@0
   915
size_t example_mbrtowc()
sl@0
   916
{
sl@0
   917
 size_t len;
sl@0
   918
 wchar_t wc[100];
sl@0
   919
 char *s = 'a';
sl@0
   920
 size_t n = 1;
sl@0
   921
 mbstate_t ps;
sl@0
   922
 /* converting multibyte sequence to a wide-char sequence */
sl@0
   923
 len = mbrtowc(wc,(const char *) s, n, &ps;);
sl@0
   924
 /* checking for error value */
sl@0
   925
 if(len < 0)
sl@0
   926
 {
sl@0
   927
        wprintf(L"mbrtowc returned error!!
sl@0
   928
");
sl@0
   929
 }
sl@0
   930
 /* returning no of bytes consumed */
sl@0
   931
 return (len);
sl@0
   932
}
sl@0
   933
sl@0
   934
@endcode
sl@0
   935
sl@0
   936
Errors:
sl@0
   937
sl@0
   938
The mbrtowc function will fail if: 
sl@0
   939
[EILSEQ] An invalid multibyte sequence was detected.  
sl@0
   940
[EINVAL]The conversion state is invalid. 
sl@0
   941
sl@0
   942
 
sl@0
   943
Limitations:
sl@0
   944
sl@0
   945
The current implementation of mbrtowc is not affected by the LC_CTYPE category of the current locale.
sl@0
   946
It works only for UTF8 character set.
sl@0
   947
sl@0
   948
@see mbtowc()
sl@0
   949
@see setlocale()
sl@0
   950
@see wcrtomb()
sl@0
   951
sl@0
   952
sl@0
   953
 
sl@0
   954
sl@0
   955
@publishedAll
sl@0
   956
@externallyDefinedApi
sl@0
   957
*/
sl@0
   958
sl@0
   959
/** @fn  mbsinit(const mbstate_t *ps)
sl@0
   960
@param ps
sl@0
   961
sl@0
   962
@return   The mbsinit function returns non-zero if ps is NULL or describes an initial conversion state,
sl@0
   963
otherwise it returns zero.
sl@0
   964
sl@0
   965
  The mbsinit function determines whether the mbstate_t
sl@0
   966
object pointed to by ps describes an initial conversion state.
sl@0
   967
sl@0
   968
 The behavior of the mbsinit is affected by LC_CTYPE category of the current locale.
sl@0
   969
sl@0
   970
Examples:
sl@0
   971
@code
sl@0
   972
#include <stdlib.h>
sl@0
   973
#include <wchar.h>
sl@0
   974
/* Illustrates how to use mbsinit API */
sl@0
   975
int example_mbsinit(void)
sl@0
   976
{
sl@0
   977
 mbstate_t mbs;
sl@0
   978
 int state;
sl@0
   979
 
sl@0
   980
 /* testing for the initial state */
sl@0
   981
 state = mbsinit(&mbs;);
sl@0
   982
 /* return the state */
sl@0
   983
 return(state);
sl@0
   984
}
sl@0
   985
sl@0
   986
@endcode
sl@0
   987
sl@0
   988
Limitations:
sl@0
   989
sl@0
   990
The current implementation of mbsinit is not affected by the LC_CTYPE category of the current locale.
sl@0
   991
It works only for UTF8 character set.
sl@0
   992
sl@0
   993
@see mbrlen()
sl@0
   994
@see mbrtowc()
sl@0
   995
@see mbsrtowcs()
sl@0
   996
@see wcrtomb()
sl@0
   997
@see wcsrtombs()
sl@0
   998
sl@0
   999
sl@0
  1000
 
sl@0
  1001
sl@0
  1002
@publishedAll
sl@0
  1003
@externallyDefinedApi
sl@0
  1004
*/
sl@0
  1005
sl@0
  1006
/** @fn  mbsrtowcs(wchar_t *  dst, const char **  src, size_t len, mbstate_t *  ps)
sl@0
  1007
@param dst
sl@0
  1008
@param src
sl@0
  1009
@param len
sl@0
  1010
@param ps
sl@0
  1011
sl@0
  1012
Note: This description also covers the following functions -
sl@0
  1013
 mbsnrtowcs() 
sl@0
  1014
sl@0
  1015
@return   The mbsrtowcs and mbsnrtowcs functions return the number of wide characters stored in 
sl@0
  1016
the array pointed to by dst if successful, otherwise it returns ( size_t)(-1).
sl@0
  1017
sl@0
  1018
  The mbsrtowcs function converts a sequence of multibyte characters pointed to indirectly by src into a sequence of corresponding wide characters and stores at most len of them in the wchar_t
sl@0
  1019
array pointed to by dst, until it encounters a terminating null character ('\\0'.)
sl@0
  1020
sl@0
  1021
 If dst is NULL no characters are stored.
sl@0
  1022
sl@0
  1023
 If dst is not NULL, the pointer pointed to by src is updated to point to the character after the one that conversion stopped at.
sl@0
  1024
If conversion stops because a null character is encountered, *src is set to NULL.
sl@0
  1025
sl@0
  1026
 The mbstate_t
sl@0
  1027
argument, ps, is used to keep track of the shift state.
sl@0
  1028
If it is NULL, mbsrtowcs uses an internal, static mbstate_t
sl@0
  1029
object, which is initialized to the initial conversion state
sl@0
  1030
at program startup.
sl@0
  1031
sl@0
  1032
 The mbsnrtowcs function behaves identically to mbsrtowcs, except that conversion stops after reading at most nms bytes from the buffer pointed to by src.
sl@0
  1033
sl@0
  1034
 The behavior of the mbsrtowcs and mbsnrtowcs is affected by LC_CTYPE category of the current locale.
sl@0
  1035
sl@0
  1036
Examples:
sl@0
  1037
@code
sl@0
  1038
/* Illustrates how to use mbsrtowcs API */
sl@0
  1039
#include <stdio.h>
sl@0
  1040
#include <stdlib.h>
sl@0
  1041
#include <wchar.h>
sl@0
  1042
size_t example_mbsrtowcs(wchar_t *wc, char *s, size_t n)
sl@0
  1043
{
sl@0
  1044
 size_t len;
sl@0
  1045
 mbstate_t mbs;
sl@0
  1046
 /* converting multibyte string to a wide-char string */
sl@0
  1047
 len = mbsrtowcs(wc, &s;, n, &mbs;);
sl@0
  1048
 /* checking for error */
sl@0
  1049
 if(len < 0)
sl@0
  1050
 {
sl@0
  1051
        wprintf(L"mbsrtowcs returned error!!
sl@0
  1052
");
sl@0
  1053
 }
sl@0
  1054
 /* returning no of bytes consumed */
sl@0
  1055
 return (len);
sl@0
  1056
}
sl@0
  1057
sl@0
  1058
@endcode
sl@0
  1059
@code
sl@0
  1060
/* Illustrates how to use mbsrntowcs API */
sl@0
  1061
#include <stdio.h>
sl@0
  1062
#include <stdlib.h>
sl@0
  1063
#include <wchar.h>
sl@0
  1064
size_t example_mbsnrtowcs(wchar_t *wc, char *s, size_t n, size_t nms)
sl@0
  1065
{
sl@0
  1066
  size_t len;
sl@0
  1067
  mbstate_t mbs;
sl@0
  1068
 /* converting multibyte string to a wide-char string */
sl@0
  1069
  len = mbsnrtowcs(wc, &s;, nms, n, &mbs;);
sl@0
  1070
 /* checking for error */
sl@0
  1071
 if(len < 0)
sl@0
  1072
 {
sl@0
  1073
        wprintf(L"mbsnrtowcs returned error!!
sl@0
  1074
");
sl@0
  1075
 }
sl@0
  1076
  /* returning no of bytes consumed */
sl@0
  1077
  return (len);
sl@0
  1078
}
sl@0
  1079
sl@0
  1080
@endcode
sl@0
  1081
sl@0
  1082
Errors:
sl@0
  1083
sl@0
  1084
The mbsrtowcs and mbsnrtowcs functions will fail if: 
sl@0
  1085
[EILSEQ]An invalid multibyte character sequence was encountered.  
sl@0
  1086
[EINVAL] The conversion state is invalid.
sl@0
  1087
sl@0
  1088
sl@0
  1089
Limitations:
sl@0
  1090
sl@0
  1091
The current implementation of mbsrtowcs and mbsnrtowcs is not affected by the LC_CTYPE category of the current locale.
sl@0
  1092
It works only for UTF8 character set.
sl@0
  1093
sl@0
  1094
@see mbrtowc()
sl@0
  1095
@see mbstowcs()
sl@0
  1096
@see wcsrtombs()
sl@0
  1097
sl@0
  1098
sl@0
  1099
 
sl@0
  1100
sl@0
  1101
@publishedAll
sl@0
  1102
@externallyDefinedApi
sl@0
  1103
*/
sl@0
  1104
sl@0
  1105
sl@0
  1106
/** @fn  putwc(wchar_t wc, FILE *stream)
sl@0
  1107
@param wc
sl@0
  1108
@param stream
sl@0
  1109
sl@0
  1110
Refer to fputwc() for the documentation
sl@0
  1111
sl@0
  1112
@see ferror()
sl@0
  1113
@see fopen()
sl@0
  1114
@see getwc()
sl@0
  1115
@see putc()
sl@0
  1116
sl@0
  1117
sl@0
  1118
 
sl@0
  1119
sl@0
  1120
@publishedAll
sl@0
  1121
@externallyDefinedApi
sl@0
  1122
*/
sl@0
  1123
sl@0
  1124
/** @fn  putwchar(wchar_t wc)
sl@0
  1125
@param wc
sl@0
  1126
sl@0
  1127
Refer to  fputwc() for the documentation
sl@0
  1128
sl@0
  1129
@see ferror()
sl@0
  1130
@see fopen()
sl@0
  1131
@see getwc()
sl@0
  1132
@see putc()
sl@0
  1133
sl@0
  1134
sl@0
  1135
 
sl@0
  1136
sl@0
  1137
@publishedAll
sl@0
  1138
@externallyDefinedApi
sl@0
  1139
*/
sl@0
  1140
sl@0
  1141
/** @fn  swprintf(wchar_t *  s, size_t n, const wchar_t *  fmt, ...)
sl@0
  1142
@param s
sl@0
  1143
@param n
sl@0
  1144
@param fmt
sl@0
  1145
@param ...
sl@0
  1146
sl@0
  1147
Refer to fwprintf() for the documentation
sl@0
  1148
sl@0
  1149
@see btowc()
sl@0
  1150
@see fputws()
sl@0
  1151
@see printf()
sl@0
  1152
@see putwc()
sl@0
  1153
@see setlocale()
sl@0
  1154
@see wcsrtombs()
sl@0
  1155
@see wscanf()
sl@0
  1156
sl@0
  1157
sl@0
  1158
 
sl@0
  1159
sl@0
  1160
@publishedAll
sl@0
  1161
@externallyDefinedApi
sl@0
  1162
*/
sl@0
  1163
sl@0
  1164
/** @fn  swscanf(const wchar_t *  str, const wchar_t *fmt, ...)
sl@0
  1165
@param str
sl@0
  1166
@param fmt
sl@0
  1167
@param ...
sl@0
  1168
sl@0
  1169
Refer to  wscanf() for the documentation
sl@0
  1170
sl@0
  1171
@see fgetwc()
sl@0
  1172
@see scanf()
sl@0
  1173
@see wcrtomb()
sl@0
  1174
@see wcstod()
sl@0
  1175
@see wcstol()
sl@0
  1176
@see wcstoul()
sl@0
  1177
@see wprintf()
sl@0
  1178
sl@0
  1179
sl@0
  1180
 
sl@0
  1181
sl@0
  1182
@publishedAll
sl@0
  1183
@externallyDefinedApi
sl@0
  1184
*/
sl@0
  1185
sl@0
  1186
/** @fn  ungetwc(wint_t wc, FILE *stream)
sl@0
  1187
@param wc
sl@0
  1188
@param stream
sl@0
  1189
@return   The ungetwc function
sl@0
  1190
returns
sl@0
  1191
the wide character pushed-back after the conversion, or WEOF if the operation fails.
sl@0
  1192
If the value of the argument c character equals WEOF ,
sl@0
  1193
the operation will fail and the stream will remain unchanged.
sl@0
  1194
sl@0
  1195
  The ungetwc function pushes the wide character wc (converted to an wchar_t )
sl@0
  1196
back onto the input stream pointed to by stream .
sl@0
  1197
The pushed-backed wide characters will be returned by subsequent reads on the
sl@0
  1198
stream (in reverse order).
sl@0
  1199
A successful intervening call, using the same stream, to one of the file
sl@0
  1200
positioning functions fseek , fsetpos ,
sl@0
  1201
or rewind will discard the pushed back wide characters.
sl@0
  1202
sl@0
  1203
 One wide character of push-back is guaranteed,
sl@0
  1204
but as long as there is
sl@0
  1205
sufficient memory, an effectively infinite amount of pushback is allowed.
sl@0
  1206
sl@0
  1207
 If a character is successfully pushed-back,
sl@0
  1208
the end-of-file indicator for the stream is cleared.
sl@0
  1209
sl@0
  1210
Examples:
sl@0
  1211
@code
sl@0
  1212
#include <stdio.h>
sl@0
  1213
#include <wchar.h>
sl@0
  1214
/* Illustrates how to use ungetwc API */
sl@0
  1215
wint_t example_ungetwc(void)
sl@0
  1216
{
sl@0
  1217
 FILE *fp = NULL;
sl@0
  1218
 wint_t wc1;
sl@0
  1219
 wint_t rval;
sl@0
  1220
 wint_t wc2;
sl@0
  1221
 /* opening the file to write*/
sl@0
  1222
 fp = fopen("input.txt","w");
sl@0
  1223
 if(fp == NULL)
sl@0
  1224
 {
sl@0
  1225
  wprintf(L"Error: File open
sl@0
  1226
");
sl@0
  1227
  return (-1);
sl@0
  1228
 }
sl@0
  1229
 /* character to written back to the fp */
sl@0
  1230
 wc = (wint_t) L'e';
sl@0
  1231
 /* write the character into the fp */
sl@0
  1232
 rval = ungetwc(wc, fp);
sl@0
  1233
 /* check for error */
sl@0
  1234
 if(rval == WEOF)
sl@0
  1235
 {
sl@0
  1236
        wprintf(L"ungetwc returned error!!
sl@0
  1237
");
sl@0
  1238
 }
sl@0
  1239
 /* Read the character from fp */
sl@0
  1240
 /* this char should be the same as the char */
sl@0
  1241
 /* that was written by ungetwc */
sl@0
  1242
 wc2 = getwc(fp);
sl@0
  1243
 /* Close the file opened for writing */
sl@0
  1244
 fclose(fp);
sl@0
  1245
 /* return the value that was written */
sl@0
  1246
 return (rval);
sl@0
  1247
}
sl@0
  1248
sl@0
  1249
@endcode
sl@0
  1250
@see fseek()
sl@0
  1251
@see getwc()
sl@0
  1252
sl@0
  1253
sl@0
  1254
 
sl@0
  1255
sl@0
  1256
@publishedAll
sl@0
  1257
@externallyDefinedApi
sl@0
  1258
*/
sl@0
  1259
sl@0
  1260
/** @fn  vfwprintf(FILE *  stream, const wchar_t * , va_list ap)
sl@0
  1261
@param stream
sl@0
  1262
@param fmt0
sl@0
  1263
@param ap
sl@0
  1264
sl@0
  1265
Refer to fwprintf() for the documentation
sl@0
  1266
sl@0
  1267
@see btowc()
sl@0
  1268
@see fputws()
sl@0
  1269
@see printf()
sl@0
  1270
@see putwc()
sl@0
  1271
@see setlocale()
sl@0
  1272
@see wcsrtombs()
sl@0
  1273
@see wscanf()
sl@0
  1274
sl@0
  1275
sl@0
  1276
 
sl@0
  1277
sl@0
  1278
@publishedAll
sl@0
  1279
@externallyDefinedApi
sl@0
  1280
*/
sl@0
  1281
sl@0
  1282
/** @fn  vswprintf(wchar_t *s, size_t n, const wchar_t *fmt, va_list ap)
sl@0
  1283
@param s
sl@0
  1284
@param n
sl@0
  1285
@param fmt
sl@0
  1286
@param ap
sl@0
  1287
sl@0
  1288
Refer to fwprintf() for the documentation
sl@0
  1289
sl@0
  1290
@see btowc()
sl@0
  1291
@see fputws()
sl@0
  1292
@see printf()
sl@0
  1293
@see putwc()
sl@0
  1294
@see setlocale()
sl@0
  1295
@see wcsrtombs()
sl@0
  1296
@see wscanf()
sl@0
  1297
sl@0
  1298
sl@0
  1299
 
sl@0
  1300
sl@0
  1301
@publishedAll
sl@0
  1302
@externallyDefinedApi
sl@0
  1303
*/
sl@0
  1304
sl@0
  1305
/** @fn  vwprintf(const wchar_t *  fmt, va_list ap)
sl@0
  1306
@param fmt
sl@0
  1307
@param ap
sl@0
  1308
sl@0
  1309
Refer to fwprintf() for the documentation
sl@0
  1310
sl@0
  1311
@see btowc()
sl@0
  1312
@see fputws()
sl@0
  1313
@see printf()
sl@0
  1314
@see putwc()
sl@0
  1315
@see setlocale()
sl@0
  1316
@see wcsrtombs()
sl@0
  1317
@see wscanf()
sl@0
  1318
sl@0
  1319
sl@0
  1320
 
sl@0
  1321
sl@0
  1322
@publishedAll
sl@0
  1323
@externallyDefinedApi
sl@0
  1324
*/
sl@0
  1325
sl@0
  1326
/** @fn  wcrtomb(char *  mbchar, wchar_t wc, mbstate_t *  ps)
sl@0
  1327
@param mbchar
sl@0
  1328
@param wc
sl@0
  1329
@param ps
sl@0
  1330
@return   The wcrtomb functions returns the length (in bytes) of the multibyte sequence
sl@0
  1331
needed to represent wc ,
sl@0
  1332
or ( size_t-1) if wc is not a valid wide character code.
sl@0
  1333
sl@0
  1334
  The wcrtomb function stores a multibyte sequence representing the
sl@0
  1335
wide character wc ,
sl@0
  1336
including any necessary shift sequences, to the
sl@0
  1337
character array s ,
sl@0
  1338
storing a maximum of MB_CUR_MAX bytes.
sl@0
  1339
sl@0
  1340
 If s is NULL , wcrtomb behaves as if s pointed to an internal buffer and wc was a null wide character (L'\\0').
sl@0
  1341
sl@0
  1342
 The mbstate_t argument, ps ,
sl@0
  1343
is used to keep track of the shift state.
sl@0
  1344
If it is NULL , wcrtomb uses an internal, static mbstate_t
sl@0
  1345
object, which is initialized to the initial conversion state
sl@0
  1346
at program startup.
sl@0
  1347
sl@0
  1348
 The behavior of the wcrtomb is affected by LC_CTYPE category of the current locale.
sl@0
  1349
sl@0
  1350
Examples:
sl@0
  1351
@code
sl@0
  1352
#include <stdio.h>
sl@0
  1353
#include <stdlib.h>
sl@0
  1354
#include <wchar.h>
sl@0
  1355
/* Illustrates how to use wcrtomb API */
sl@0
  1356
int example_wcrtomb(wchar_t wc)
sl@0
  1357
{
sl@0
  1358
  char s[MAX_CUR_MAX];
sl@0
  1359
  size_t len;
sl@0
  1360
  mbstate_t mbs;
sl@0
  1361
  
sl@0
  1362
  /* represent a wide-char in a single byte*/
sl@0
  1363
  len = wcrtomb(s, wc, &mbs;);
sl@0
  1364
  /* return the number of bytes */
sl@0
  1365
  return(len);
sl@0
  1366
}
sl@0
  1367
sl@0
  1368
@endcode
sl@0
  1369
sl@0
  1370
Errors:
sl@0
  1371
sl@0
  1372
The wcrtomb function will fail if: 
sl@0
  1373
[EILSEQ] An invalid wide character code was specified.  
sl@0
  1374
[EINVAL]  The conversion state is invalid.
sl@0
  1375
sl@0
  1376
sl@0
  1377
Limitations:
sl@0
  1378
sl@0
  1379
The current implementation of wcrtomb is not affected by the LC_CTYPE category of the current locale.
sl@0
  1380
It works only for UTF8 character set.
sl@0
  1381
sl@0
  1382
@see mbrtowc()
sl@0
  1383
@see setlocale()
sl@0
  1384
@see wctomb()
sl@0
  1385
sl@0
  1386
sl@0
  1387
 
sl@0
  1388
sl@0
  1389
@publishedAll
sl@0
  1390
@externallyDefinedApi
sl@0
  1391
*/
sl@0
  1392
sl@0
  1393
/** @fn  wcscat(wchar_t *  s1, const wchar_t *  s2)
sl@0
  1394
@param s1
sl@0
  1395
@param s2
sl@0
  1396
sl@0
  1397
Refer to wmemchr() for the documentation
sl@0
  1398
sl@0
  1399
@see memchr()
sl@0
  1400
@see memcmp()
sl@0
  1401
@see memcpy()
sl@0
  1402
@see memmove()
sl@0
  1403
@see memset()
sl@0
  1404
@see strcat()
sl@0
  1405
@see strchr()
sl@0
  1406
@see strcmp()
sl@0
  1407
@see strcpy()
sl@0
  1408
@see strcspn()
sl@0
  1409
@see strlen()
sl@0
  1410
@see strncat()
sl@0
  1411
@see strncmp()
sl@0
  1412
@see strncpy()
sl@0
  1413
@see strpbrk()
sl@0
  1414
@see strrchr()
sl@0
  1415
@see strspn()
sl@0
  1416
@see strstr()
sl@0
  1417
sl@0
  1418
sl@0
  1419
 
sl@0
  1420
sl@0
  1421
@publishedAll
sl@0
  1422
@externallyDefinedApi
sl@0
  1423
*/
sl@0
  1424
sl@0
  1425
/** @fn  wcschr(const wchar_t *s, wchar_t c)
sl@0
  1426
@param s
sl@0
  1427
@param c
sl@0
  1428
sl@0
  1429
Refer to wmemchr() for the documentation
sl@0
  1430
sl@0
  1431
@see memchr()
sl@0
  1432
@see memcmp()
sl@0
  1433
@see memcpy()
sl@0
  1434
@see memmove()
sl@0
  1435
@see memset()
sl@0
  1436
@see strcat()
sl@0
  1437
@see strchr()
sl@0
  1438
@see strcmp()
sl@0
  1439
@see strcpy()
sl@0
  1440
@see strcspn()
sl@0
  1441
@see strlen()
sl@0
  1442
@see strncat()
sl@0
  1443
@see strncmp()
sl@0
  1444
@see strncpy()
sl@0
  1445
@see strpbrk()
sl@0
  1446
@see strrchr()
sl@0
  1447
@see strspn()
sl@0
  1448
@see strstr()
sl@0
  1449
sl@0
  1450
sl@0
  1451
 
sl@0
  1452
sl@0
  1453
@publishedAll
sl@0
  1454
@externallyDefinedApi
sl@0
  1455
*/
sl@0
  1456
sl@0
  1457
/** @fn  wcscmp(const wchar_t *s1, const wchar_t *s2)
sl@0
  1458
@param s1
sl@0
  1459
@param s2
sl@0
  1460
sl@0
  1461
Refer to wmemchr() for the documentation
sl@0
  1462
sl@0
  1463
@see memchr()
sl@0
  1464
@see memcmp()
sl@0
  1465
@see memcpy()
sl@0
  1466
@see memmove()
sl@0
  1467
@see memset()
sl@0
  1468
@see strcat()
sl@0
  1469
@see strchr()
sl@0
  1470
@see strcmp()
sl@0
  1471
@see strcpy()
sl@0
  1472
@see strcspn()
sl@0
  1473
@see strlen()
sl@0
  1474
@see strncat()
sl@0
  1475
@see strncmp()
sl@0
  1476
@see strncpy()
sl@0
  1477
@see strpbrk()
sl@0
  1478
@see strrchr()
sl@0
  1479
@see strspn()
sl@0
  1480
@see strstr()
sl@0
  1481
sl@0
  1482
sl@0
  1483
 
sl@0
  1484
sl@0
  1485
@publishedAll
sl@0
  1486
@externallyDefinedApi
sl@0
  1487
*/
sl@0
  1488
sl@0
  1489
/** @fn  wcscoll(const wchar_t *ws1, const wchar_t *ws2)
sl@0
  1490
@param ws1
sl@0
  1491
@param ws2
sl@0
  1492
@return   The wcscoll function
sl@0
  1493
returns an integer greater than, equal to, or less than 0,
sl@0
  1494
if ws1 is greater than, equal to, or less than ws2 . No return value is reserved to indicate errors;
sl@0
  1495
callers should set errno to 0 before calling wcscoll .
sl@0
  1496
If it is non-zero upon return from wcscoll ,
sl@0
  1497
an error has occurred.
sl@0
  1498
sl@0
  1499
  The wcscoll function compares the null-terminated strings ws1 and ws2 according to the current locale collation order.
sl@0
  1500
In the "C"
sl@0
  1501
locale, wcscoll is equivalent to wcscmp .
sl@0
  1502
sl@0
  1503
Examples:
sl@0
  1504
@code
sl@0
  1505
#include <wchar.h>
sl@0
  1506
/* Illustrates how to use wcscoll API */
sl@0
  1507
int example_wcscoll (void)
sl@0
  1508
{  
sl@0
  1509
        /* compares the two strings */
sl@0
  1510
  if( wcscoll(L"abcdef",L"abcdeg") != L'f'-L'g')  
sl@0
  1511
   return -1;
sl@0
  1512
 return 0;
sl@0
  1513
}
sl@0
  1514
sl@0
  1515
@endcode
sl@0
  1516
sl@0
  1517
Errors:
sl@0
  1518
sl@0
  1519
The wcscoll function will fail if: 
sl@0
  1520
[EILSEQ] An invalid wide character code was specified.  
sl@0
  1521
[ENOMEM]  Cannot allocate enough memory for temporary buffers.
sl@0
  1522
sl@0
  1523
sl@0
  1524
Limitations:
sl@0
  1525
sl@0
  1526
The current implementation of wcscoll is not affected by the LC_CTYPE category of the current locale. It is equivalent to wcscmp in this implementation.
sl@0
  1527
sl@0
  1528
@see setlocale()
sl@0
  1529
@see strcoll()
sl@0
  1530
@see wcscmp()
sl@0
  1531
@see wcsxfrm()
sl@0
  1532
sl@0
  1533
sl@0
  1534
Bugs:
sl@0
  1535
sl@0
  1536
 The current implementation of wcscoll only works in single-byte LC_CTYPE locales, and falls back to using wcscmp in locales with extended character sets. 
sl@0
  1537
sl@0
  1538
 
sl@0
  1539
sl@0
  1540
@publishedAll
sl@0
  1541
@externallyDefinedApi
sl@0
  1542
*/
sl@0
  1543
sl@0
  1544
/** @fn  wcscpy(wchar_t *  s1, const wchar_t *  s2)
sl@0
  1545
@param s1
sl@0
  1546
@param s2
sl@0
  1547
sl@0
  1548
Refer to wmemchr() for the documentation
sl@0
  1549
sl@0
  1550
@see memchr()
sl@0
  1551
@see memcmp()
sl@0
  1552
@see memcpy()
sl@0
  1553
@see memmove()
sl@0
  1554
@see memset()
sl@0
  1555
@see strcat()
sl@0
  1556
@see strchr()
sl@0
  1557
@see strcmp()
sl@0
  1558
@see strcpy()
sl@0
  1559
@see strcspn()
sl@0
  1560
@see strlen()
sl@0
  1561
@see strncat()
sl@0
  1562
@see strncmp()
sl@0
  1563
@see strncpy()
sl@0
  1564
@see strpbrk()
sl@0
  1565
@see strrchr()
sl@0
  1566
@see strspn()
sl@0
  1567
@see strstr()
sl@0
  1568
sl@0
  1569
sl@0
  1570
 
sl@0
  1571
sl@0
  1572
@publishedAll
sl@0
  1573
@externallyDefinedApi
sl@0
  1574
*/
sl@0
  1575
sl@0
  1576
sl@0
  1577
/** @fn  wcscspn(const wchar_t *s1, const wchar_t *s2)
sl@0
  1578
@param s1
sl@0
  1579
@param s2
sl@0
  1580
sl@0
  1581
Refer to wmemchr() for the documentation
sl@0
  1582
sl@0
  1583
@see memchr()
sl@0
  1584
@see memcmp()
sl@0
  1585
@see memcpy()
sl@0
  1586
@see memmove()
sl@0
  1587
@see memset()
sl@0
  1588
@see strcat()
sl@0
  1589
@see strchr()
sl@0
  1590
@see strcmp()
sl@0
  1591
@see strcpy()
sl@0
  1592
@see strcspn()
sl@0
  1593
@see strlen()
sl@0
  1594
@see strncat()
sl@0
  1595
@see strncmp()
sl@0
  1596
@see strncpy()
sl@0
  1597
@see strpbrk()
sl@0
  1598
@see strrchr()
sl@0
  1599
@see strspn()
sl@0
  1600
@see strstr()
sl@0
  1601
sl@0
  1602
sl@0
  1603
 
sl@0
  1604
sl@0
  1605
@publishedAll
sl@0
  1606
@externallyDefinedApi
sl@0
  1607
*/
sl@0
  1608
sl@0
  1609
sl@0
  1610
/** @fn  wcsftime(wchar_t *  wcs, size_t maxsize, const wchar_t *  format, const struct tm *  timeptr)
sl@0
  1611
@param wcs
sl@0
  1612
@param maxsize
sl@0
  1613
@param format
sl@0
  1614
@param timeptr
sl@0
  1615
@return   wcsftime shall return the number of wide-character codes placed into the array pointed to by wcs , not including the terminating null wide-character code. Otherwise, zero is returned and the contents of the array are unspecified.
sl@0
  1616
sl@0
  1617
  The wcsftime function is equivalent to the strftime function except for the types of its arguments.
sl@0
  1618
Refer to  strftime() for a detailed description.
sl@0
  1619
sl@0
  1620
Examples:
sl@0
  1621
@code
sl@0
  1622
#include <wchar.h>
sl@0
  1623
#include <time.h>
sl@0
  1624
/* Illustatrates how to use wcsftime API */
sl@0
  1625
int example_wcsftime()
sl@0
  1626
{  
sl@0
  1627
  wchar_t datestring[50];
sl@0
  1628
  int retval;
sl@0
  1629
  struct tm *tm;
sl@0
  1630
 
sl@0
  1631
  /* get the current time */
sl@0
  1632
  time_t t = time(NULL);
sl@0
  1633
 
sl@0
  1634
  /* get the local time from the current time */
sl@0
  1635
  tm = localtime(&t;);
sl@0
  1636
  /* convert date and time to a wide-character string */
sl@0
  1637
  retval = wcsftime(datestring,15,L"%A",tm);
sl@0
  1638
 
sl@0
  1639
  /* If the total number of resulting wide-character codes */
sl@0
  1640
  /* including the terminating null wide-character code is */
sl@0
  1641
  /* no more than maxsize, wcsftime() shall return the number */
sl@0
  1642
  /* of wide-character codes placed into the array pointed to */
sl@0
  1643
  /* by wcs, not including the terminating null wide-character */
sl@0
  1644
  /* code. Otherwise, zero is returned and the contents of the */
sl@0
  1645
  /* array are unspecified.*/
sl@0
  1646
  return retval;
sl@0
  1647
}
sl@0
  1648
sl@0
  1649
@endcode
sl@0
  1650
 
sl@0
  1651
 
sl@0
  1652
sl@0
  1653
@publishedAll
sl@0
  1654
@externallyDefinedApi
sl@0
  1655
*/
sl@0
  1656
sl@0
  1657
sl@0
  1658
/** @fn  wcslen(const wchar_t *s)
sl@0
  1659
@param s
sl@0
  1660
sl@0
  1661
Refer to wmemchr() for the documentation
sl@0
  1662
sl@0
  1663
@see memchr()
sl@0
  1664
@see memcmp()
sl@0
  1665
@see memcpy()
sl@0
  1666
@see memmove()
sl@0
  1667
@see memset()
sl@0
  1668
@see strcat()
sl@0
  1669
@see strchr()
sl@0
  1670
@see strcmp()
sl@0
  1671
@see strcpy()
sl@0
  1672
@see strcspn()
sl@0
  1673
@see strlen()
sl@0
  1674
@see strncat()
sl@0
  1675
@see strncmp()
sl@0
  1676
@see strncpy()
sl@0
  1677
@see strpbrk()
sl@0
  1678
@see strrchr()
sl@0
  1679
@see strspn()
sl@0
  1680
@see strstr()
sl@0
  1681
sl@0
  1682
sl@0
  1683
 
sl@0
  1684
sl@0
  1685
@publishedAll
sl@0
  1686
@externallyDefinedApi
sl@0
  1687
*/
sl@0
  1688
sl@0
  1689
sl@0
  1690
sl@0
  1691
/** @fn  wcsncat(wchar_t *  s1, const wchar_t *  s2, size_t n)
sl@0
  1692
@param s1
sl@0
  1693
@param s2
sl@0
  1694
@param n
sl@0
  1695
sl@0
  1696
Refer to wmemchr() for the documentation
sl@0
  1697
sl@0
  1698
@see memchr()
sl@0
  1699
@see memcmp()
sl@0
  1700
@see memcpy()
sl@0
  1701
@see memmove()
sl@0
  1702
@see memset()
sl@0
  1703
@see strcat()
sl@0
  1704
@see strchr()
sl@0
  1705
@see strcmp()
sl@0
  1706
@see strcpy()
sl@0
  1707
@see strcspn()
sl@0
  1708
@see strlen()
sl@0
  1709
@see strncat()
sl@0
  1710
@see strncmp()
sl@0
  1711
@see strncpy()
sl@0
  1712
@see strpbrk()
sl@0
  1713
@see strrchr()
sl@0
  1714
@see strspn()
sl@0
  1715
@see strstr()
sl@0
  1716
sl@0
  1717
sl@0
  1718
 
sl@0
  1719
sl@0
  1720
@publishedAll
sl@0
  1721
@externallyDefinedApi
sl@0
  1722
*/
sl@0
  1723
sl@0
  1724
sl@0
  1725
sl@0
  1726
/** @fn  wcsncmp(const wchar_t *s1, const wchar_t * s2, size_t n)
sl@0
  1727
@param s1
sl@0
  1728
@param s2
sl@0
  1729
@param n
sl@0
  1730
sl@0
  1731
Refer to wmemchr() for the documentation
sl@0
  1732
sl@0
  1733
@see memchr()
sl@0
  1734
@see memcmp()
sl@0
  1735
@see memcpy()
sl@0
  1736
@see memmove()
sl@0
  1737
@see memset()
sl@0
  1738
@see strcat()
sl@0
  1739
@see strchr()
sl@0
  1740
@see strcmp()
sl@0
  1741
@see strcpy()
sl@0
  1742
@see strcspn()
sl@0
  1743
@see strlen()
sl@0
  1744
@see strncat()
sl@0
  1745
@see strncmp()
sl@0
  1746
@see strncpy()
sl@0
  1747
@see strpbrk()
sl@0
  1748
@see strrchr()
sl@0
  1749
@see strspn()
sl@0
  1750
@see strstr()
sl@0
  1751
sl@0
  1752
sl@0
  1753
 
sl@0
  1754
sl@0
  1755
@publishedAll
sl@0
  1756
@externallyDefinedApi
sl@0
  1757
*/
sl@0
  1758
sl@0
  1759
sl@0
  1760
/** @fn  wcsncpy(wchar_t *  dst, const wchar_t *  src, size_t n)
sl@0
  1761
@param dst
sl@0
  1762
@param src
sl@0
  1763
@param n
sl@0
  1764
sl@0
  1765
Refer to wmemchr() for the documentation
sl@0
  1766
sl@0
  1767
@see memchr()
sl@0
  1768
@see memcmp()
sl@0
  1769
@see memcpy()
sl@0
  1770
@see memmove()
sl@0
  1771
@see memset()
sl@0
  1772
@see strcat()
sl@0
  1773
@see strchr()
sl@0
  1774
@see strcmp()
sl@0
  1775
@see strcpy()
sl@0
  1776
@see strcspn()
sl@0
  1777
@see strlen()
sl@0
  1778
@see strncat()
sl@0
  1779
@see strncmp()
sl@0
  1780
@see strncpy()
sl@0
  1781
@see strpbrk()
sl@0
  1782
@see strrchr()
sl@0
  1783
@see strspn()
sl@0
  1784
@see strstr()
sl@0
  1785
sl@0
  1786
sl@0
  1787
 
sl@0
  1788
sl@0
  1789
@publishedAll
sl@0
  1790
@externallyDefinedApi
sl@0
  1791
*/
sl@0
  1792
sl@0
  1793
sl@0
  1794
/** @fn  wcspbrk(const wchar_t *s1, const wchar_t *s2)
sl@0
  1795
@param s1
sl@0
  1796
@param s2
sl@0
  1797
sl@0
  1798
Refer to wmemchr() for the documentation
sl@0
  1799
sl@0
  1800
@see memchr()
sl@0
  1801
@see memcmp()
sl@0
  1802
@see memcpy()
sl@0
  1803
@see memmove()
sl@0
  1804
@see memset()
sl@0
  1805
@see strcat()
sl@0
  1806
@see strchr()
sl@0
  1807
@see strcmp()
sl@0
  1808
@see strcpy()
sl@0
  1809
@see strcspn()
sl@0
  1810
@see strlen()
sl@0
  1811
@see strncat()
sl@0
  1812
@see strncmp()
sl@0
  1813
@see strncpy()
sl@0
  1814
@see strpbrk()
sl@0
  1815
@see strrchr()
sl@0
  1816
@see strspn()
sl@0
  1817
@see strstr()
sl@0
  1818
sl@0
  1819
sl@0
  1820
 
sl@0
  1821
sl@0
  1822
@publishedAll
sl@0
  1823
@externallyDefinedApi
sl@0
  1824
*/
sl@0
  1825
sl@0
  1826
sl@0
  1827
/** @fn  wcsrchr(const wchar_t *s, wchar_t c)
sl@0
  1828
@param s
sl@0
  1829
@param c
sl@0
  1830
sl@0
  1831
Refer to wmemchr() for the documentation
sl@0
  1832
sl@0
  1833
@see memchr()
sl@0
  1834
@see memcmp()
sl@0
  1835
@see memcpy()
sl@0
  1836
@see memmove()
sl@0
  1837
@see memset()
sl@0
  1838
@see strcat()
sl@0
  1839
@see strchr()
sl@0
  1840
@see strcmp()
sl@0
  1841
@see strcpy()
sl@0
  1842
@see strcspn()
sl@0
  1843
@see strlen()
sl@0
  1844
@see strncat()
sl@0
  1845
@see strncmp()
sl@0
  1846
@see strncpy()
sl@0
  1847
@see strpbrk()
sl@0
  1848
@see strrchr()
sl@0
  1849
@see strspn()
sl@0
  1850
@see strstr()
sl@0
  1851
sl@0
  1852
sl@0
  1853
 
sl@0
  1854
sl@0
  1855
@publishedAll
sl@0
  1856
@externallyDefinedApi
sl@0
  1857
*/
sl@0
  1858
sl@0
  1859
sl@0
  1860
/** @fn  wcsrtombs(char *  dst, const wchar_t **  src, size_t len, mbstate_t *  ps)
sl@0
  1861
@param dst
sl@0
  1862
@param src
sl@0
  1863
@param len
sl@0
  1864
@param ps
sl@0
  1865
sl@0
  1866
Note: This description also covers the following functions -
sl@0
  1867
 wcsnrtombs() 
sl@0
  1868
sl@0
  1869
@return   The wcsrtombs and wcsnrtombs functions return the number of bytes stored in
sl@0
  1870
the array pointed to by dst (not including any terminating null), if successful, otherwise it returns ( size_t-1) .
sl@0
  1871
sl@0
  1872
  The wcsrtombs function converts a string of wide characters indirectly pointed to by src to a corresponding multibyte character string stored in the array
sl@0
  1873
pointed to by dst .
sl@0
  1874
No more than len bytes are written to dst .
sl@0
  1875
sl@0
  1876
 If dst is NULL ,
sl@0
  1877
no characters are stored.
sl@0
  1878
sl@0
  1879
 If dst is not NULL ,
sl@0
  1880
the pointer pointed to by src is updated to point to the character after the one that conversion stopped at.
sl@0
  1881
If conversion stops because a null character is encountered, *src is set to NULL .
sl@0
  1882
sl@0
  1883
 The mbstate_t
sl@0
  1884
argument, ps ,
sl@0
  1885
is used to keep track of the shift state.
sl@0
  1886
If it is NULL , wcsrtombs uses an internal, static mbstate_t
sl@0
  1887
object, which is initialized to the initial conversion state
sl@0
  1888
at program startup.
sl@0
  1889
sl@0
  1890
 The wcsnrtombs function behaves identically to wcsrtombs ,
sl@0
  1891
except that conversion stops after reading at most nwc characters from the buffer pointed to by src .
sl@0
  1892
The behavior of the wcsrtombs and wcsrntombs is affected by LC_CTYPE category of the current locale.
sl@0
  1893
sl@0
  1894
Examples:
sl@0
  1895
@code
sl@0
  1896
#include <stdlib.h>
sl@0
  1897
#include <wchar.h>
sl@0
  1898
/* Illustrates how to use wcsrtombs API */
sl@0
  1899
size_t example_wcsrtombs(wchar_t *wcs, char *s, size_t n)
sl@0
  1900
{
sl@0
  1901
 size_t len;
sl@0
  1902
 mstate_t mbs;
sl@0
  1903
 /* converting multibyte string to a wide-char string */
sl@0
  1904
 len = wcsrtombs(s, &wcs;, n, &mbs;);
sl@0
  1905
 /* returning no of bytes that make up the multibyte sequence */
sl@0
  1906
 return (len;);
sl@0
  1907
}
sl@0
  1908
sl@0
  1909
@endcode
sl@0
  1910
@code
sl@0
  1911
#include <stdlib.h>
sl@0
  1912
#include <wchar.h>
sl@0
  1913
/* Illustrates how to use wcsnrtombs API */
sl@0
  1914
size_t example_wcsnrtombs(wchar_t *wcs, char *s, size_t n, szie_t nmwc)
sl@0
  1915
{
sl@0
  1916
 size_t len;
sl@0
  1917
 mstate_t mbs;
sl@0
  1918
 /* converting multibyte string to a wide-char string */
sl@0
  1919
 len = wcsrtombs(s, &wcs;, nwc, n, &mbs;);
sl@0
  1920
 /* returning no of bytes that make up the multibyte sequence */
sl@0
  1921
 return (len;);
sl@0
  1922
}
sl@0
  1923
sl@0
  1924
@endcode
sl@0
  1925
sl@0
  1926
Limitations:
sl@0
  1927
sl@0
  1928
The current implementation of wcsrtombs and wcsnrtombs is not affected by the LC_CTYPE category of the current locale.
sl@0
  1929
It works only for UTF8 character set.
sl@0
  1930
sl@0
  1931
@see mbsrtowcs()
sl@0
  1932
@see wcrtomb()
sl@0
  1933
@see wcstombs()
sl@0
  1934
sl@0
  1935
sl@0
  1936
 
sl@0
  1937
sl@0
  1938
@publishedAll
sl@0
  1939
@externallyDefinedApi
sl@0
  1940
*/
sl@0
  1941
sl@0
  1942
sl@0
  1943
/** @fn  wcsspn(const wchar_t *s1, const wchar_t *s2)
sl@0
  1944
@param s1
sl@0
  1945
@param s2
sl@0
  1946
sl@0
  1947
Refer to wmemchr() for the documentation
sl@0
  1948
sl@0
  1949
@see memchr()
sl@0
  1950
@see memcmp()
sl@0
  1951
@see memcpy()
sl@0
  1952
@see memmove()
sl@0
  1953
@see memset()
sl@0
  1954
@see strcat()
sl@0
  1955
@see strchr()
sl@0
  1956
@see strcmp()
sl@0
  1957
@see strcpy()
sl@0
  1958
@see strcspn()
sl@0
  1959
@see strlen()
sl@0
  1960
@see strncat()
sl@0
  1961
@see strncmp()
sl@0
  1962
@see strncpy()
sl@0
  1963
@see strpbrk()
sl@0
  1964
@see strrchr()
sl@0
  1965
@see strspn()
sl@0
  1966
@see strstr()
sl@0
  1967
sl@0
  1968
sl@0
  1969
 
sl@0
  1970
sl@0
  1971
@publishedAll
sl@0
  1972
@externallyDefinedApi
sl@0
  1973
*/
sl@0
  1974
sl@0
  1975
sl@0
  1976
sl@0
  1977
/** @fn  wcsstr(const wchar_t *  s, const wchar_t *  find)
sl@0
  1978
@param s
sl@0
  1979
@param find
sl@0
  1980
sl@0
  1981
Refer to wmemchr() for the documentation
sl@0
  1982
sl@0
  1983
@see memchr()
sl@0
  1984
@see memcmp()
sl@0
  1985
@see memcpy()
sl@0
  1986
@see memmove()
sl@0
  1987
@see memset()
sl@0
  1988
@see strcat()
sl@0
  1989
@see strchr()
sl@0
  1990
@see strcmp()
sl@0
  1991
@see strcpy()
sl@0
  1992
@see strcspn()
sl@0
  1993
@see strlen()
sl@0
  1994
@see strncat()
sl@0
  1995
@see strncmp()
sl@0
  1996
@see strncpy()
sl@0
  1997
@see strpbrk()
sl@0
  1998
@see strrchr()
sl@0
  1999
@see strspn()
sl@0
  2000
@see strstr()
sl@0
  2001
sl@0
  2002
sl@0
  2003
 
sl@0
  2004
sl@0
  2005
@publishedAll
sl@0
  2006
@externallyDefinedApi
sl@0
  2007
*/
sl@0
  2008
sl@0
  2009
sl@0
  2010
sl@0
  2011
/** @fn  wcsxfrm(wchar_t *  dest, const wchar_t *  src, size_t len)
sl@0
  2012
@param dest
sl@0
  2013
@param src
sl@0
  2014
@param len
sl@0
  2015
@return   Upon successful completion, wcsxfrm returns the length of the transformed string not including
sl@0
  2016
the terminating null character.
sl@0
  2017
If this value is len or more, the contents of dest are indeterminate.
sl@0
  2018
sl@0
  2019
  The wcsxfrm function transforms a null-terminated wide character string pointed to by src according to the current locale collation order
sl@0
  2020
then copies the transformed string
sl@0
  2021
into dest .
sl@0
  2022
No more than len wide characters are copied into dest ,
sl@0
  2023
including the terminating null character added.
sl@0
  2024
If len is set to 0
sl@0
  2025
(it helps to determine an actual size needed
sl@0
  2026
for transformation), dest is permitted to be a NULL pointer.
sl@0
  2027
sl@0
  2028
 Comparing two strings using wcscmp after wcsxfrm is equivalent to comparing
sl@0
  2029
two original strings with wcscoll .
sl@0
  2030
sl@0
  2031
Examples:
sl@0
  2032
@code
sl@0
  2033
#include <stdlib.h>
sl@0
  2034
#include <wchar.h>
sl@0
  2035
/* Illustrates how to use wcpcpy API */
sl@0
  2036
int example_wcpcpy()
sl@0
  2037
{ 
sl@0
  2038
  /* input string for which length to be found */
sl@0
  2039
 wchar_t *src = L"testcase";
sl@0
  2040
  wchar_t *dest = NULL;
sl@0
  2041
  int      length; 
sl@0
  2042
    
sl@0
  2043
  /* allocate memory for the destination string */
sl@0
  2044
  dest = (wchar_t *)malloc((wcslen(src)+1)*sizeof(wchar_t));
sl@0
  2045
    
sl@0
  2046
  /*  perform the operation */
sl@0
  2047
  if(dest != NULL)
sl@0
  2048
   length = wcsxfrm(dest,src,9);
sl@0
  2049
  else
sl@0
  2050
  { 
sl@0
  2051
   wprintf(L"ERROR : Cannot allocate memory");
sl@0
  2052
  return -1;
sl@0
  2053
  } 
sl@0
  2054
  return length;
sl@0
  2055
}
sl@0
  2056
sl@0
  2057
@endcode
sl@0
  2058
sl@0
  2059
Limitations:
sl@0
  2060
sl@0
  2061
The current implementation of wcsxfrm works only for "C" locale.
sl@0
  2062
sl@0
  2063
@see setlocale()
sl@0
  2064
@see strxfrm()
sl@0
  2065
@see wcscmp()
sl@0
  2066
@see wcscoll()
sl@0
  2067
sl@0
  2068
sl@0
  2069
Bugs:
sl@0
  2070
sl@0
  2071
 The current implementation of wcsxfrm only works in single-byte LC_CTYPE locales, and falls back to using wcsncpy in locales with extended character sets. Comparing two strings using wcscmp after wcsxfrm is not always equivalent to comparison with wcscoll ; wcsxfrm only stores information about primary collation weights into dst ,
sl@0
  2072
whereas wcscoll compares characters using both primary and secondary weights. 
sl@0
  2073
sl@0
  2074
 
sl@0
  2075
sl@0
  2076
@publishedAll
sl@0
  2077
@externallyDefinedApi
sl@0
  2078
*/
sl@0
  2079
sl@0
  2080
sl@0
  2081
sl@0
  2082
/** @fn  wctob(wint_t c)
sl@0
  2083
@param c
sl@0
  2084
sl@0
  2085
Refer to btowc() for the documentation
sl@0
  2086
sl@0
  2087
@see mbrtowc()
sl@0
  2088
@see wcrtomb()
sl@0
  2089
sl@0
  2090
sl@0
  2091
 
sl@0
  2092
sl@0
  2093
@publishedAll
sl@0
  2094
@externallyDefinedApi
sl@0
  2095
*/
sl@0
  2096
sl@0
  2097
sl@0
  2098
sl@0
  2099
/** @fn  wcstod(const wchar_t *  nptr, wchar_t **  endptr)
sl@0
  2100
@param nptr
sl@0
  2101
@param endptr
sl@0
  2102
sl@0
  2103
Refer to wcstof() for the documentation
sl@0
  2104
sl@0
  2105
@see strtod()
sl@0
  2106
@see wcstol()
sl@0
  2107
sl@0
  2108
sl@0
  2109
 
sl@0
  2110
sl@0
  2111
@publishedAll
sl@0
  2112
@externallyDefinedApi
sl@0
  2113
*/
sl@0
  2114
sl@0
  2115
sl@0
  2116
sl@0
  2117
/** @fn  wcstok(wchar_t *  s, const wchar_t *  delim, wchar_t **  last)
sl@0
  2118
@param s
sl@0
  2119
@param delim
sl@0
  2120
@param last
sl@0
  2121
@return   The wcstok function
sl@0
  2122
returns a pointer to the beginning of each subsequent token in the string,
sl@0
  2123
after replacing the token itself with a null wide character (L'//0').
sl@0
  2124
When no more tokens remain, a null pointer is returned.
sl@0
  2125
sl@0
  2126
  The wcstok function
sl@0
  2127
is used to isolate sequential tokens in a null-terminated wide character
sl@0
  2128
string, s.
sl@0
  2129
These tokens are separated in the string by at least one of the
sl@0
  2130
characters in delim .
sl@0
  2131
The first time that wcstok is called, s should be specified; subsequent calls, wishing to obtain further tokens
sl@0
  2132
from the same string, should pass a null pointer instead.
sl@0
  2133
The separator string, delim ,
sl@0
  2134
must be supplied each time, and may change between calls.
sl@0
  2135
The context pointer last must be provided on each call.
sl@0
  2136
sl@0
  2137
 The wcstok function is the wide character counterpart of the strtok_r function.
sl@0
  2138
sl@0
  2139
sl@0
  2140
Examples:
sl@0
  2141
sl@0
  2142
@code
sl@0
  2143
#include <wchar.h>
sl@0
  2144
/* Illustrates how to use wcstok API */
sl@0
  2145
int example_wcstok()
sl@0
  2146
{  
sl@0
  2147
  /* source wide character string */
sl@0
  2148
 const wchar_t *seps = L"onetwhr";
sl@0
  2149
 wchar_t *last, *tok, text[] = L"onetwothree";
sl@0
  2150
              
sl@0
  2151
 tok = wcstok(text, seps, &last;);
sl@0
  2152
 if(tok == NULL)
sl@0
  2153
   return 0;
sl@0
  2154
 else
sl@0
  2155
    return 1;
sl@0
  2156
}
sl@0
  2157
sl@0
  2158
@endcode
sl@0
  2159
sl@0
  2160
Examples:
sl@0
  2161
sl@0
  2162
 The following code fragment splits a wide character string on ASCII space, tab and newline characters and writes the tokens to
sl@0
  2163
standard output:
sl@0
  2164
sl@0
  2165
@code
sl@0
  2166
const wchar_t *seps = L" 	
sl@0
  2167
";
sl@0
  2168
wchar_t *last, *tok, text[] = L" 
sl@0
  2169
one	two		three  
sl@0
  2170
";
sl@0
  2171
for (tok = wcstok(text, seps, &last;); tok != NULL;
sl@0
  2172
    tok = wcstok(NULL, seps, &last;))
sl@0
  2173
        wprintf(L"%ls
sl@0
  2174
", tok);
sl@0
  2175
sl@0
  2176
@endcode
sl@0
  2177
@see strtok()
sl@0
  2178
@see wcschr()
sl@0
  2179
@see wcscspn()
sl@0
  2180
@see wcspbrk()
sl@0
  2181
@see wcsrchr()
sl@0
  2182
@see wcsspn()
sl@0
  2183
sl@0
  2184
sl@0
  2185
Some early implementations of wcstok omit the context pointer argument, last, and maintain state across calls in a static variable like strtok does.
sl@0
  2186
sl@0
  2187
sl@0
  2188
@publishedAll
sl@0
  2189
@externallyDefinedApi
sl@0
  2190
*/
sl@0
  2191
sl@0
  2192
sl@0
  2193
sl@0
  2194
/** @fn  wcstol(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  2195
@param nptr
sl@0
  2196
@param endptr
sl@0
  2197
@param base
sl@0
  2198
sl@0
  2199
Note: This description also covers the following functions -
sl@0
  2200
 wcstoul()  wcstoll()  wcstoull()  wcstoq()  wcstouq()  wcstoimax()  wcstoumax() 
sl@0
  2201
sl@0
  2202
@return   errno may be set to indicate the error. If the correct value is outside 
sl@0
  2203
  the range of representable values {LONG_MIN}, {LONG_MAX}, {LLONG_MIN}, or {LLONG_MAX} 
sl@0
  2204
  is returned (according to the sign of the value) and errno set to [ERANGE].
sl@0
  2205
sl@0
  2206
  The wcstol , wcstoul , wcstoll , wcstoull , wcstoimax and wcstoumax functions are wide-character versions of the strtol , strtoul , strtoll , strtoull , strtoimax and strtoumax functions, respectively.
sl@0
  2207
Refer to their manual pages (for example strtol )
sl@0
  2208
for details.
sl@0
  2209
The wcstoq and wcstouq are respectively equivalent to wcstoll and wcstoull.
sl@0
  2210
sl@0
  2211
Examples:
sl@0
  2212
@code
sl@0
  2213
#include <wchar.h>
sl@0
  2214
/* Illustrates how to use wcstoumax API */
sl@0
  2215
uintmax_t example_wcstoumax()
sl@0
  2216
{  
sl@0
  2217
  /* src string */
sl@0
  2218
 wchar_t *src = L"478";
sl@0
  2219
  uintmax_t longVal;
sl@0
  2220
    
sl@0
  2221
  /* convert the wide character string to uintmax_t */
sl@0
  2222
  longVal = wcstoumax(src,NULL,10);
sl@0
  2223
  /* return the converted long value */
sl@0
  2224
 return longVal;
sl@0
  2225
}
sl@0
  2226
sl@0
  2227
@endcode
sl@0
  2228
@code
sl@0
  2229
#include <wchar.h>
sl@0
  2230
/* Illustrates how to use wcstoimax API */
sl@0
  2231
intmax_t example_wcstoimax()
sl@0
  2232
{  
sl@0
  2233
  /* src string */
sl@0
  2234
 wchar_t *src = L"478";
sl@0
  2235
  intmax_t longVal;
sl@0
  2236
    
sl@0
  2237
  /* convert the wide character string to intmax_t */
sl@0
  2238
  longVal = wcstoimax(src,NULL,10);
sl@0
  2239
  /* return the converted long value */
sl@0
  2240
 return longVal;
sl@0
  2241
}
sl@0
  2242
sl@0
  2243
@endcode
sl@0
  2244
@code
sl@0
  2245
#include <wchar.h>
sl@0
  2246
/* Illustrates how to use wcstol API */
sl@0
  2247
long example_wcstol()
sl@0
  2248
{  
sl@0
  2249
  /* src string */
sl@0
  2250
 wchar_t *src = L"478";
sl@0
  2251
  long  longVal;
sl@0
  2252
    
sl@0
  2253
  /* call the API to convert src string to long value */
sl@0
  2254
  longVal = wcstol(src,NULL,10);
sl@0
  2255
  /* return the converted long value */
sl@0
  2256
 return longVal;
sl@0
  2257
}
sl@0
  2258
sl@0
  2259
@endcode
sl@0
  2260
@code
sl@0
  2261
#include <wchar.h>
sl@0
  2262
/* Illustrates how to use wcstoul API */
sl@0
  2263
unsigned long example_wcstoul()
sl@0
  2264
{  
sl@0
  2265
  /* src string */
sl@0
  2266
  wchar_t *src = L"478";
sl@0
  2267
  unsigned long  longVal;
sl@0
  2268
    
sl@0
  2269
  /* call the API to convert src string to unsigned */
sl@0
  2270
  /* long value */
sl@0
  2271
  longVal = wcstoul(src,NULL,10);
sl@0
  2272
  /* return the converted long value */
sl@0
  2273
 return longVal;
sl@0
  2274
}
sl@0
  2275
sl@0
  2276
@endcode
sl@0
  2277
@code
sl@0
  2278
#include <wchar.h>
sl@0
  2279
/* Illustatrates how to use wcstoll API */
sl@0
  2280
long long example_wcstoll()
sl@0
  2281
{ 
sl@0
  2282
  /* input string for which length to be found */
sl@0
  2283
 wchar_t *src = L"478";
sl@0
  2284
 long long  longVal;
sl@0
  2285
    
sl@0
  2286
  /* perform the conversion operation from wide */
sl@0
  2287
  /* char string to long long value */
sl@0
  2288
  longVal = wcstoll(src,NULL,10);
sl@0
  2289
     
sl@0
  2290
  return longVal;
sl@0
  2291
}
sl@0
  2292
sl@0
  2293
@endcode
sl@0
  2294
@code
sl@0
  2295
#include <wchar.h>
sl@0
  2296
/* Illustatrates how to use wcstoull API */
sl@0
  2297
unsigned long long example_wcstoull()
sl@0
  2298
{ 
sl@0
  2299
  /* input string for which length to be found */
sl@0
  2300
 wchar_t *src = L"478";
sl@0
  2301
  unsigned long long  longVal;
sl@0
  2302
    
sl@0
  2303
  /* perform the conversion operation from wide */
sl@0
  2304
  /*char string to unsigned long long value */
sl@0
  2305
  longVal = wcstoull(src,NULL,10);
sl@0
  2306
     
sl@0
  2307
  return longVal;
sl@0
  2308
}
sl@0
  2309
sl@0
  2310
@endcode
sl@0
  2311
@code
sl@0
  2312
#include <wchar.h>
sl@0
  2313
/* Illustrates how to use wcstoq API */
sl@0
  2314
long long int example_wcstoq()
sl@0
  2315
{ 
sl@0
  2316
 /* src string that contains decimal digits */
sl@0
  2317
 wchar_t *src = L"478";
sl@0
  2318
 long long int  longVal;
sl@0
  2319
 /* convert the decimal wide char string to long long int value */
sl@0
  2320
 longVal = wcstoq(src,NULL,10);
sl@0
  2321
 /* return longVal and its value should be 478 */
sl@0
  2322
 return longVal;
sl@0
  2323
}
sl@0
  2324
sl@0
  2325
@endcode
sl@0
  2326
@code
sl@0
  2327
#include <wchar.h>
sl@0
  2328
/* Illustrates how to use wcstouq API */
sl@0
  2329
unsigned long long int example_wcstouq()
sl@0
  2330
{ 
sl@0
  2331
 /* src string that contains decimal digits */
sl@0
  2332
 wchar_t *src = L"478";
sl@0
  2333
 unsigned long long int  longVal;
sl@0
  2334
 /* convert the decimal wide char string  to unsigned long long int value */
sl@0
  2335
 longVal = wcstouq(src,NULL,10);
sl@0
  2336
 /* return longVal, which should be 478 */   
sl@0
  2337
 return longVal;
sl@0
  2338
}
sl@0
  2339
sl@0
  2340
@endcode
sl@0
  2341
@see strtol()
sl@0
  2342
@see strtoul()
sl@0
  2343
sl@0
  2344
sl@0
  2345
 
sl@0
  2346
sl@0
  2347
@publishedAll
sl@0
  2348
@externallyDefinedApi
sl@0
  2349
*/
sl@0
  2350
sl@0
  2351
sl@0
  2352
sl@0
  2353
/** @fn  wcstoul(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  2354
@param nptr
sl@0
  2355
@param endptr
sl@0
  2356
@param base
sl@0
  2357
sl@0
  2358
Refer to wcstol() for the documentation
sl@0
  2359
sl@0
  2360
@see strtol()
sl@0
  2361
@see strtoul()
sl@0
  2362
sl@0
  2363
sl@0
  2364
 
sl@0
  2365
sl@0
  2366
@publishedAll
sl@0
  2367
@externallyDefinedApi
sl@0
  2368
*/
sl@0
  2369
sl@0
  2370
sl@0
  2371
sl@0
  2372
/** @fn  wmemchr(const wchar_t *s, wchar_t c, size_t n)
sl@0
  2373
@param s
sl@0
  2374
@param c
sl@0
  2375
@param n
sl@0
  2376
sl@0
  2377
Note: This description also covers the following functions -
sl@0
  2378
 wmemcmp()  wmemcpy()  wmemmove()  wmemset()  wcscat()  wcschr()  wcscmp()  wcscpy()  wcscspn()  wcslcat()  wcslcpy()  wcslen()  wcsncat()  wcsncmp()  wcsncpy()  wcspbrk()  wcsrchr()  wcsspn()  wcsstr() 
sl@0
  2379
sl@0
  2380
@return   wmemchr function returns a pointer to the first occurrence of c among the n wide characters starting at s , or NULL if c does not occur among these. wcslcpy function returns wcslen(src); if retval \>= siz, truncation occurred wcslcat function returns wcslen(initial dst) + wcslen(src); if retval \>= sizet,
sl@0
  2381
sl@0
  2382
 
sl@0
  2383
sl@0
  2384
sl@0
  2385
sl@0
  2386
 The function wcslcat() appends a copy of the wide-character string
sl@0
  2387
pointed to by s2 (including the terminating null wide-character code) to the end
sl@0
  2388
of the wide-character string pointed to by s1. The initial wide-character code
sl@0
  2389
of string pointed to by s2 overwrites the null wide-character code at the end of s1. wcslcat() concatenates at most n-1 characters.
sl@0
  2390
sl@0
  2391
sl@0
  2392
sl@0
  2393
 The function wcslcpy() copies the wide-character string pointed to by s2 (including the terminating null wide-character code) into the array pointed to by s1.
sl@0
  2394
It will copy at most n-1 characters.
sl@0
  2395
sl@0
  2396
sl@0
  2397
sl@0
  2398
 The functions implement string manipulation operations over wide character
sl@0
  2399
strings.
sl@0
  2400
For a detailed description, refer to documents for the respective single-byte
sl@0
  2401
counterpart, such as memchr .
sl@0
  2402
sl@0
  2403
Examples:
sl@0
  2404
@code
sl@0
  2405
#include <wchar.h>
sl@0
  2406
/* Illustrates how to use wmemcmp API */
sl@0
  2407
int example_wmemcmp()
sl@0
  2408
{  
sl@0
  2409
  /* source wide character string */
sl@0
  2410
  wchar_t *ws1 = L"test case",*ws2 = L"test case";
sl@0
  2411
  int retval;
sl@0
  2412
 /* comparing the 2 wide-char strings */
sl@0
  2413
 retval = wmemcmp(ws1,ws2,500);
sl@0
  2414
  /* checking for the return value */
sl@0
  2415
  if(retval != 0)
sl@0
  2416
   return 1;
sl@0
  2417
  else
sl@0
  2418
   return 0;
sl@0
  2419
}
sl@0
  2420
sl@0
  2421
@endcode
sl@0
  2422
@code
sl@0
  2423
#include <wchar.h>
sl@0
  2424
/* Illustrates how to use wmemcpy API */
sl@0
  2425
int example_wmemcpy()
sl@0
  2426
{  
sl@0
  2427
  /* source wide character string */
sl@0
  2428
  wchar_t ws1[50]=L"abcdefghij",*retval,ws2[50]=L"test";
sl@0
  2429
  /* compare the strings */
sl@0
  2430
  retval = wmemcpy(ws1,ws2,6);
sl@0
  2431
  for(int i=0;i<6;i++)
sl@0
  2432
  {
sl@0
  2433
   if(retval[i] != ws2[i] || ws1[i] != ws2[i])
sl@0
  2434
    return 1;
sl@0
  2435
  }
sl@0
  2436
  return 0;
sl@0
  2437
}
sl@0
  2438
sl@0
  2439
@endcode
sl@0
  2440
@code
sl@0
  2441
#include <wchar.h>
sl@0
  2442
/* Illustrates how to use wmemmove API */
sl@0
  2443
int example_wmemmove()
sl@0
  2444
{  
sl@0
  2445
  /* source wide character string */
sl@0
  2446
  wchar_t ws1[50]=L"abcdefghij",*retval,ws2[5] = L"abc";
sl@0
  2447
  int i;
sl@0
  2448
 
sl@0
  2449
  /* move the contents of ws2 to ws1 */
sl@0
  2450
  retval = wmemmove(ws1,ws2,3);
sl@0
  2451
 /* compare the contents */
sl@0
  2452
  for(i=0;i<3;i++)
sl@0
  2453
  {
sl@0
  2454
   if(ws1[i] != ws2[i])
sl@0
  2455
     return 1;
sl@0
  2456
  }
sl@0
  2457
  return 0;
sl@0
  2458
}
sl@0
  2459
sl@0
  2460
@endcode
sl@0
  2461
@code
sl@0
  2462
#include <wchar.h>
sl@0
  2463
/* Illustrates how to use wmemset API */
sl@0
  2464
int example_wmemset()
sl@0
  2465
{  
sl@0
  2466
  /* source wide character string */
sl@0
  2467
  wchar_t ws1[50]=L"abcdefghij", *retval;
sl@0
  2468
  int i;
sl@0
  2469
  /* setting the wide-string ws1 */
sl@0
  2470
  retval = wmemset(ws1,L'a',7);
sl@0
  2471
 /* comparing the contents */
sl@0
  2472
  for(i=0;i<7;i++)
sl@0
  2473
  {
sl@0
  2474
   if(ws1[i] != L'a')
sl@0
  2475
     return 1;
sl@0
  2476
  }
sl@0
  2477
  return 0;
sl@0
  2478
}
sl@0
  2479
sl@0
  2480
@endcode
sl@0
  2481
@code
sl@0
  2482
#include <wchar.h>
sl@0
  2483
/* Illustrates how to use wmemchr API */
sl@0
  2484
wchar_t *example_wmemchr(void)
sl@0
  2485
{
sl@0
  2486
 wchar_t *wcs = L"lmnopqr";
sl@0
  2487
 size_t n;
sl@0
  2488
 wchar_t wc = L'p';
sl@0
  2489
 wchar_t *res;
sl@0
  2490
 /* number of wide characters to be searched */
sl@0
  2491
 n = wcslen(wcs);
sl@0
  2492
 /* search for the occurence of wchar wc in wide-char string wcs */
sl@0
  2493
 res = wmemchr(wcs, wc, n);
sl@0
  2494
 /* return the pointer */
sl@0
  2495
 return(res);
sl@0
  2496
}
sl@0
  2497
sl@0
  2498
@endcode
sl@0
  2499
@code
sl@0
  2500
#include <wchar.h>
sl@0
  2501
/* Illustrates how to use wcslen API */
sl@0
  2502
size_t example_wcslen(void)
sl@0
  2503
{
sl@0
  2504
 wchar_t *wcs = L"defqwert";
sl@0
  2505
 size_t len;
sl@0
  2506
 /* compute the length of the wide-char string */
sl@0
  2507
 len = wcslen(wcs);
sl@0
  2508
 /* return the length of the wide-char string */
sl@0
  2509
 return (len);
sl@0
  2510
}
sl@0
  2511
sl@0
  2512
@endcode
sl@0
  2513
@code
sl@0
  2514
#include <wchar.h>
sl@0
  2515
/* Illustrates how to use wcscat API */
sl@0
  2516
void example_wcscat(void)
sl@0
  2517
{
sl@0
  2518
 wchar_t wcs[100] = L"abc";
sl@0
  2519
 wchar_t *wcs1 = L"def";
sl@0
  2520
 wchar *res;
sl@0
  2521
 /* concatenate the two strings */
sl@0
  2522
 res = wcscat(wcs, wcs1);
sl@0
  2523
 /* print the string that resulted from concatenation */
sl@0
  2524
 wprintf(L"Output wide-char string is : %ls
sl@0
  2525
",res);
sl@0
  2526
}
sl@0
  2527
sl@0
  2528
@endcode
sl@0
  2529
 Output
sl@0
  2530
@code
sl@0
  2531
abcdef
sl@0
  2532
sl@0
  2533
@endcode
sl@0
  2534
@code
sl@0
  2535
#include <wchar.h>
sl@0
  2536
/* Illustrates how to use wcschr API */
sl@0
  2537
int example_ wcschr ()
sl@0
  2538
{  
sl@0
  2539
  /* source wide character string */
sl@0
  2540
 wchar_t search_char[15] = L"&&&&$%%%%%TTU";
sl@0
  2541
 wchar_t *wstr;
sl@0
  2542
 int i ;
sl@0
  2543
 for(i = 0 ; search_char[i]; i++)
sl@0
  2544
 {
sl@0
  2545
   wstr = wcschr(L"", search_char[i]);
sl@0
  2546
   if(wstr != NULL)
sl@0
  2547
   {
sl@0
  2548
    return -1;
sl@0
  2549
   }
sl@0
  2550
 }
sl@0
  2551
 return 0;
sl@0
  2552
}
sl@0
  2553
sl@0
  2554
@endcode
sl@0
  2555
@code
sl@0
  2556
int example_wcscmp()
sl@0
  2557
{  
sl@0
  2558
  /* source wide character string */
sl@0
  2559
 wchar_t *wcs1 = "string1";
sl@0
  2560
 wchar_t *wcs2 = "string2";
sl@0
  2561
 int i ;
sl@0
  2562
 i = wcscmp(wcs1, wcs2);
sl@0
  2563
 if( i == 0)
sl@0
  2564
  return -1;
sl@0
  2565
 
sl@0
  2566
 i = wcscmp(wcs1, L"string1");
sl@0
  2567
 if(i != 0)
sl@0
  2568
  return -1;
sl@0
  2569
 
sl@0
  2570
 return 0;
sl@0
  2571
}
sl@0
  2572
sl@0
  2573
@endcode
sl@0
  2574
@code
sl@0
  2575
#include <wchar.h>
sl@0
  2576
/* Illustrates how to use wcscpy API */
sl@0
  2577
int example_wcscpy ()
sl@0
  2578
{  
sl@0
  2579
  /* source wide character string */
sl@0
  2580
  wchar_t wcs1[15];
sl@0
  2581
  wchar_t *res;
sl@0
  2582
 
sl@0
  2583
  /* copy the wide-char string into wcs1*/
sl@0
  2584
  res = wcscpy(wcs1, L"Hello world");
sl@0
  2585
 
sl@0
  2586
  if(wcscmp(res, L"Hello world") != 0)
sl@0
  2587
   return -1;
sl@0
  2588
 
sl@0
  2589
  return 0;
sl@0
  2590
}
sl@0
  2591
sl@0
  2592
@endcode
sl@0
  2593
@code
sl@0
  2594
#include <wchar.h>
sl@0
  2595
/* Illustrates how to use wcslcpy API */
sl@0
  2596
int example_wcslcpy ()
sl@0
  2597
{  
sl@0
  2598
  /* source wide character string */
sl@0
  2599
  wchar_t src[25] = L"Source";
sl@0
  2600
  wchar_t dest[20]= L"Destination";
sl@0
  2601
 
sl@0
  2602
  /* copy the wide-char string into dest*/
sl@0
  2603
 
sl@0
  2604
        size_t t = wcslcpy(dest,src,4);
sl@0
  2605
                
sl@0
  2606
                if(wcscmp(dest,L"Sou")!=0)
sl@0
  2607
    return -1;
sl@0
  2608
 
sl@0
  2609
  return 0;
sl@0
  2610
}
sl@0
  2611
sl@0
  2612
@endcode
sl@0
  2613
@code
sl@0
  2614
#include <wchar.h>
sl@0
  2615
/* Illustrates how to use wcslcat API */
sl@0
  2616
int example_wcslcat ()
sl@0
  2617
{  
sl@0
  2618
  /* source wide character string */
sl@0
  2619
  wchar_t src[25] = L"Source";
sl@0
  2620
  wchar_t dest[20]= L"Destination";
sl@0
  2621
 
sl@0
  2622
  /* concate the wide-char string into dest*/
sl@0
  2623
 
sl@0
  2624
        size_t t = wcslcat(dest,src,14);
sl@0
  2625
                
sl@0
  2626
                if(wcscmp(dest,"DestinationSo")!=0)
sl@0
  2627
    return -1;
sl@0
  2628
 
sl@0
  2629
  return 0;
sl@0
  2630
}
sl@0
  2631
sl@0
  2632
@endcode
sl@0
  2633
@code
sl@0
  2634
#include <wchar.h>
sl@0
  2635
/* Illustrates how to use wcscspnAPI */
sl@0
  2636
int example_wcscspn ()
sl@0
  2637
{  
sl@0
  2638
  /* source wide character string */
sl@0
  2639
  wchar_t wcs1[30] = L"1234567890ABCDE!@#$$";
sl@0
  2640
  wchar_t *wcs2[20] = { L"abcdefghijkl",
sl@0
  2641
     L":::?>_)+(|{>",
sl@0
  2642
     L"~*(&IUIJJJ;",
sl@0
  2643
     L"1234567",
sl@0
  2644
     L":::?>",
sl@0
  2645
     L"1",
sl@0
  2646
     L"as1sd2ds3ds48f5fd"
sl@0
  2647
   };
sl@0
  2648
  int i;
sl@0
  2649
 
sl@0
  2650
  for( i = 0; i < 3 ; i ++)
sl@0
  2651
  {
sl@0
  2652
   if( wcslen(wcs1) != wcscspn(wcs1,wcs2[i]))
sl@0
  2653
     return -1;
sl@0
  2654
  }
sl@0
  2655
 
sl@0
  2656
  return 0;
sl@0
  2657
}
sl@0
  2658
sl@0
  2659
@endcode
sl@0
  2660
@code
sl@0
  2661
#include <wchar.h>
sl@0
  2662
/* Illustrates how to use wcsncat API */
sl@0
  2663
int example_wcsncat ()
sl@0
  2664
{  
sl@0
  2665
  /* source wide character string */
sl@0
  2666
  wchar_t *res;
sl@0
  2667
  wchar_t str[50];
sl@0
  2668
 
sl@0
  2669
  wcscpy(str, L"Hello");
sl@0
  2670
  res = wcsncat(str,L" world",12);
sl@0
  2671
 if(wcscmp(str, L"Hello world") != 0)
sl@0
  2672
  return -1;
sl@0
  2673
 else
sl@0
  2674
  return 0;
sl@0
  2675
}
sl@0
  2676
sl@0
  2677
@endcode
sl@0
  2678
@code
sl@0
  2679
#include <wchar.h>
sl@0
  2680
/* Illustrates how to use wcsncmp API */
sl@0
  2681
int example_wcsncmp()
sl@0
  2682
{  
sl@0
  2683
  /* source wide character string */
sl@0
  2684
  wchar_t *wcs1 = L"Hello world";
sl@0
  2685
  if(wcsncmp(wcs1,wcs1,wcslen(wcs1))) 
sl@0
  2686
   return -1;
sl@0
  2687
  else
sl@0
  2688
   return 0;
sl@0
  2689
}
sl@0
  2690
sl@0
  2691
@endcode
sl@0
  2692
@code
sl@0
  2693
#include <wchar.h>
sl@0
  2694
/* Illustrates how to use wcsncpy API */
sl@0
  2695
int example_wcsncpy ()
sl@0
  2696
{  
sl@0
  2697
  /* source wide character string */
sl@0
  2698
  wchar_t wcs1[15] = L"Hello world";
sl@0
  2699
  wchar_t *res;
sl@0
  2700
  res = wcsncpy(wcs1,wcs1,wcslen(wcs1));
sl@0
  2701
  if(wcscmp(res,wcs1))
sl@0
  2702
  return -1;
sl@0
  2703
  return 0;
sl@0
  2704
}
sl@0
  2705
sl@0
  2706
@endcode
sl@0
  2707
@code
sl@0
  2708
#include <wchar.h>
sl@0
  2709
/* Illustrates how to use wcspbrk API */
sl@0
  2710
int example_wcspbrk ()
sl@0
  2711
{  
sl@0
  2712
  /* source wide character string */
sl@0
  2713
 wchar_t *wcs = L"abcdefghijkl";
sl@0
  2714
  wchar_t *res1 = wcspbrk(wcs, L"");
sl@0
  2715
  if(res1 != NULL)
sl@0
  2716
   return -1;
sl@0
  2717
 
sl@0
  2718
  return 0;
sl@0
  2719
}
sl@0
  2720
sl@0
  2721
@endcode
sl@0
  2722
@code
sl@0
  2723
#include <wchar.h>
sl@0
  2724
/* Illustrates how to use wcsrchr API */
sl@0
  2725
int example_wcsrchr ()
sl@0
  2726
{  
sl@0
  2727
  /* source wide character string */
sl@0
  2728
 wchar_t search_char[15] = L"&&&&$%%%%%TTU";
sl@0
  2729
  wchar_t *wstr;
sl@0
  2730
  int i ;
sl@0
  2731
 
sl@0
  2732
  for(i = 0 ; search_char[i]; i++)
sl@0
  2733
  {
sl@0
  2734
   wstr = wcsrchr(L"", search_char[i]);
sl@0
  2735
   if(wstr != NULL)
sl@0
  2736
   {
sl@0
  2737
     return -1;
sl@0
  2738
   }
sl@0
  2739
  }
sl@0
  2740
  return 0;
sl@0
  2741
}
sl@0
  2742
sl@0
  2743
@endcode
sl@0
  2744
@code
sl@0
  2745
#include <wchar.h>
sl@0
  2746
/* Illustrates how to use wcsspn API */
sl@0
  2747
int example_wcsspn()
sl@0
  2748
{  
sl@0
  2749
  /* source wide character string */
sl@0
  2750
 wchar_t wcs1[30] = L"1234567890ABCDE!@#$$";
sl@0
  2751
 if(wcslen(wcs1) != wcsspn(wcs1,wcs1)) 
sl@0
  2752
  return -1;
sl@0
  2753
 return 0;
sl@0
  2754
}
sl@0
  2755
sl@0
  2756
@endcode
sl@0
  2757
@code
sl@0
  2758
#include <wchar.h>
sl@0
  2759
/* Illustrates how to use wcsstr API */
sl@0
  2760
int example_wcsstr()
sl@0
  2761
{  
sl@0
  2762
  /* source wide character string */
sl@0
  2763
 wchar_t *buf[20] = { L"fkhsdf%%38",L"rtti123123", };
sl@0
  2764
 wchar_t *str  = wcsstr(buf[0],L"\0");
sl@0
  2765
 wchar_t *str1 = wcsstr(buf[1],L"\0");
sl@0
  2766
 if(wcscmp(str,buf[0]))
sl@0
  2767
   return 1;
sl@0
  2768
 if(wcscmp(str1,buf[1]))
sl@0
  2769
   return 1
sl@0
  2770
 return 0;
sl@0
  2771
}
sl@0
  2772
sl@0
  2773
@endcode
sl@0
  2774
@see memchr()
sl@0
  2775
@see memcmp()
sl@0
  2776
@see memcpy()
sl@0
  2777
@see memmove()
sl@0
  2778
@see memset()
sl@0
  2779
@see strcat()
sl@0
  2780
@see strchr()
sl@0
  2781
@see strcmp()
sl@0
  2782
@see strcpy()
sl@0
  2783
@see strcspn()
sl@0
  2784
@see strlen()
sl@0
  2785
@see strncat()
sl@0
  2786
@see strncmp()
sl@0
  2787
@see strncpy()
sl@0
  2788
@see strpbrk()
sl@0
  2789
@see strrchr()
sl@0
  2790
@see strspn()
sl@0
  2791
@see strstr()
sl@0
  2792
sl@0
  2793
sl@0
  2794
 
sl@0
  2795
sl@0
  2796
@publishedAll
sl@0
  2797
@externallyDefinedApi
sl@0
  2798
*/
sl@0
  2799
sl@0
  2800
sl@0
  2801
sl@0
  2802
/** @fn  wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
sl@0
  2803
@param s1
sl@0
  2804
@param s2
sl@0
  2805
@param n
sl@0
  2806
sl@0
  2807
Refer to wmemchr() for the documentation
sl@0
  2808
sl@0
  2809
@see memchr()
sl@0
  2810
@see memcmp()
sl@0
  2811
@see memcpy()
sl@0
  2812
@see memmove()
sl@0
  2813
@see memset()
sl@0
  2814
@see strcat()
sl@0
  2815
@see strchr()
sl@0
  2816
@see strcmp()
sl@0
  2817
@see strcpy()
sl@0
  2818
@see strcspn()
sl@0
  2819
@see strlen()
sl@0
  2820
@see strncat()
sl@0
  2821
@see strncmp()
sl@0
  2822
@see strncpy()
sl@0
  2823
@see strpbrk()
sl@0
  2824
@see strrchr()
sl@0
  2825
@see strspn()
sl@0
  2826
@see strstr()
sl@0
  2827
sl@0
  2828
sl@0
  2829
 
sl@0
  2830
sl@0
  2831
@publishedAll
sl@0
  2832
@externallyDefinedApi
sl@0
  2833
*/
sl@0
  2834
sl@0
  2835
sl@0
  2836
sl@0
  2837
/** @fn  wmemcpy(wchar_t *  s1, const wchar_t *  s2, size_t n)
sl@0
  2838
@param s1
sl@0
  2839
@param s2
sl@0
  2840
@param n
sl@0
  2841
sl@0
  2842
Refer to wmemchr() for the documentation
sl@0
  2843
sl@0
  2844
@see memchr()
sl@0
  2845
@see memcmp()
sl@0
  2846
@see memcpy()
sl@0
  2847
@see memmove()
sl@0
  2848
@see memset()
sl@0
  2849
@see strcat()
sl@0
  2850
@see strchr()
sl@0
  2851
@see strcmp()
sl@0
  2852
@see strcpy()
sl@0
  2853
@see strcspn()
sl@0
  2854
@see strlen()
sl@0
  2855
@see strncat()
sl@0
  2856
@see strncmp()
sl@0
  2857
@see strncpy()
sl@0
  2858
@see strpbrk()
sl@0
  2859
@see strrchr()
sl@0
  2860
@see strspn()
sl@0
  2861
@see strstr()
sl@0
  2862
sl@0
  2863
sl@0
  2864
 
sl@0
  2865
sl@0
  2866
@publishedAll
sl@0
  2867
@externallyDefinedApi
sl@0
  2868
*/
sl@0
  2869
sl@0
  2870
sl@0
  2871
sl@0
  2872
/** @fn  wmemmove(wchar_t *s1, const wchar_t *s2, size_t n)
sl@0
  2873
@param s1
sl@0
  2874
@param s2
sl@0
  2875
@param n
sl@0
  2876
sl@0
  2877
Refer to wmemchr() for the documentation
sl@0
  2878
sl@0
  2879
@see memchr()
sl@0
  2880
@see memcmp()
sl@0
  2881
@see memcpy()
sl@0
  2882
@see memmove()
sl@0
  2883
@see memset()
sl@0
  2884
@see strcat()
sl@0
  2885
@see strchr()
sl@0
  2886
@see strcmp()
sl@0
  2887
@see strcpy()
sl@0
  2888
@see strcspn()
sl@0
  2889
@see strlen()
sl@0
  2890
@see strncat()
sl@0
  2891
@see strncmp()
sl@0
  2892
@see strncpy()
sl@0
  2893
@see strpbrk()
sl@0
  2894
@see strrchr()
sl@0
  2895
@see strspn()
sl@0
  2896
@see strstr()
sl@0
  2897
sl@0
  2898
sl@0
  2899
 
sl@0
  2900
sl@0
  2901
@publishedAll
sl@0
  2902
@externallyDefinedApi
sl@0
  2903
*/
sl@0
  2904
sl@0
  2905
sl@0
  2906
sl@0
  2907
/** @fn  wmemset(wchar_t *s, wchar_t c, size_t n)
sl@0
  2908
@param s
sl@0
  2909
@param c
sl@0
  2910
@param n
sl@0
  2911
sl@0
  2912
Refer to wmemchr() for the documentation
sl@0
  2913
sl@0
  2914
@see memchr()
sl@0
  2915
@see memcmp()
sl@0
  2916
@see memcpy()
sl@0
  2917
@see memmove()
sl@0
  2918
@see memset()
sl@0
  2919
@see strcat()
sl@0
  2920
@see strchr()
sl@0
  2921
@see strcmp()
sl@0
  2922
@see strcpy()
sl@0
  2923
@see strcspn()
sl@0
  2924
@see strlen()
sl@0
  2925
@see strncat()
sl@0
  2926
@see strncmp()
sl@0
  2927
@see strncpy()
sl@0
  2928
@see strpbrk()
sl@0
  2929
@see strrchr()
sl@0
  2930
@see strspn()
sl@0
  2931
@see strstr()
sl@0
  2932
sl@0
  2933
sl@0
  2934
 
sl@0
  2935
sl@0
  2936
@publishedAll
sl@0
  2937
@externallyDefinedApi
sl@0
  2938
*/
sl@0
  2939
sl@0
  2940
sl@0
  2941
sl@0
  2942
/** @fn  wprintf(const wchar_t *fmt, ...)
sl@0
  2943
@param fmt
sl@0
  2944
@param ...
sl@0
  2945
sl@0
  2946
Refer to fwprintf() for the documentation
sl@0
  2947
sl@0
  2948
@see btowc()
sl@0
  2949
@see fputws()
sl@0
  2950
@see printf()
sl@0
  2951
@see putwc()
sl@0
  2952
@see setlocale()
sl@0
  2953
@see wcsrtombs()
sl@0
  2954
@see wscanf()
sl@0
  2955
sl@0
  2956
sl@0
  2957
 
sl@0
  2958
sl@0
  2959
@publishedAll
sl@0
  2960
@externallyDefinedApi
sl@0
  2961
*/
sl@0
  2962
sl@0
  2963
sl@0
  2964
sl@0
  2965
/** @fn  wscanf(const wchar_t *fmt, ...)
sl@0
  2966
@param fmt
sl@0
  2967
@param ...
sl@0
  2968
sl@0
  2969
Note: This description also covers the following functions -
sl@0
  2970
 fwscanf()  swscanf()  vwscanf()  vswscanf()  vfwscanf() 
sl@0
  2971
sl@0
  2972
@return   These
sl@0
  2973
functions
sl@0
  2974
return
sl@0
  2975
the number of input items assigned, which can be fewer than provided
sl@0
  2976
for, or even zero, in the event of a matching failure.
sl@0
  2977
Zero
sl@0
  2978
indicates that, while there was input available,
sl@0
  2979
no conversions were assigned;
sl@0
  2980
typically this is due to an invalid input character,
sl@0
  2981
such as an alphabetic character for a '\%d'
sl@0
  2982
conversion.
sl@0
  2983
The value EOF is returned if an input failure occurs before any conversion such as an
sl@0
  2984
end-of-file occurs.
sl@0
  2985
If an error or end-of-file occurs after conversion
sl@0
  2986
has begun,
sl@0
  2987
the number of conversions which were successfully completed is returned.
sl@0
  2988
sl@0
  2989
  The wscanf family of functions scans input according to a format as described below.
sl@0
  2990
This format may contain conversion specifiers ;
sl@0
  2991
the results from such conversions, if any,
sl@0
  2992
are stored through the pointer arguments.
sl@0
  2993
The wscanf function
sl@0
  2994
reads input from the standard input stream stdin , fwscanf reads input from the stream pointer stream ,
sl@0
  2995
and swscanf reads its input from the wide character string pointed to by str .
sl@0
  2996
The vfwscanf function
sl@0
  2997
is analogous to vfwprintf and reads input from the stream pointer stream using a variable argument list of pointers.
sl@0
  2998
The vwscanf function scans a variable argument list from the standard input and
sl@0
  2999
the vswscanf function scans it from a wide character string;
sl@0
  3000
these are analogous to
sl@0
  3001
the vwprintf and vswprintf functions respectively.
sl@0
  3002
Each successive pointer argument must correspond properly with
sl@0
  3003
each successive conversion specifier
sl@0
  3004
(but see the * conversion below).
sl@0
  3005
All conversions are introduced by the \% (percent sign) character.
sl@0
  3006
The format string
sl@0
  3007
may also contain other characters.
sl@0
  3008
White space (such as blanks, tabs, or newlines) in the format string match any amount of white space, including none, in the input.
sl@0
  3009
Everything else
sl@0
  3010
matches only itself.
sl@0
  3011
Scanning stops
sl@0
  3012
when an input character does not match such a format character.
sl@0
  3013
Scanning also stops
sl@0
  3014
when an input conversion cannot be made (see below).
sl@0
  3015
sl@0
  3016
sl@0
  3017
Conversions:
sl@0
  3018
sl@0
  3019
@code
sl@0
  3020
sl@0
  3021
Following the % character introducing a conversion there may be a number of flag characters, as follows: *  Suppresses assignment. The conversion that follows occurs as usual, but no pointer is used; the result of the conversion is simply discarded.  
sl@0
  3022
hh  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a char (rather than int ) .  
sl@0
  3023
h  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a short int (rather than int ) .  
sl@0
  3024
l (ell)  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a long int (rather than int ) , that the conversion will be one of a, e, f, or g and the next pointer is a pointer to double (rather than float ) , or that the conversion will be one of c or s and the next pointer is a pointer to an array of wchar_t (rather than char ) .  
sl@0
  3025
ll (ell ell)  
sl@0
  3026
  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a long long int (rather than int ) .  
sl@0
  3027
L  Indicates that the conversion will be one of a, e, f, or g and the next pointer is a pointer to long double .  
sl@0
  3028
j  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a intmax_t (rather than int ) .  
sl@0
  3029
t  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a ptrdiff_t (rather than int ) .  
sl@0
  3030
z  Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a size_t (rather than int ) .  
sl@0
  3031
q  (deprecated.) Indicates that the conversion will be one of dioux or n and the next pointer is a pointer to a long long int (rather than int ) .  
sl@0
  3032
sl@0
  3033
sl@0
  3034
In addition to these flags, there may be an optional maximum field width, expressed as a decimal integer, between the % and the conversion. If no width is given, a default of "infinity" is used (with one exception, below); otherwise at most this many characters are scanned in processing the conversion. Before conversion begins, most conversions skip white space; this white space is not counted against the field width. 
sl@0
  3035
sl@0
  3036
The following conversions are available: %  Matches a literal ‘%’. That is, "%%" in the format string matches a single input ‘%’ character. No conversion is done, and assignment does not occur.  
sl@0
  3037
d  Matches an optionally signed decimal integer; the next pointer must be a pointer to int .  
sl@0
  3038
i  Matches an optionally signed integer; the next pointer must be a pointer to int . The integer is read in base 16 if it begins with ‘0x’ or ‘0X’, in base 8 if it begins with ‘0’, and in base 10 otherwise. Only characters that correspond to the base are used.  
sl@0
  3039
o  Matches an octal integer; the next pointer must be a pointer to unsigned int .  
sl@0
  3040
u  Matches an optionally signed decimal integer; the next pointer must be a pointer to unsigned int .  
sl@0
  3041
x, X  Matches an optionally signed hexadecimal integer; the next pointer must be a pointer to unsigned int .  
sl@0
  3042
a, A, e, E, f, F, g, G  
sl@0
  3043
  Matches a floating-point number in the style of wcstod. The next pointer must be a pointer to float (unless l or L is specified.)  
sl@0
  3044
s  Matches a sequence of non-white-space wide characters; the next pointer must be a pointer to char , and the array must be large enough to accept the multibyte representation of all the sequence and the terminating NUL character. The input string stops at white space or at the maximum field width, whichever occurs first. 
sl@0
  3045
If an l qualifier is present, the next pointer must be a pointer to wchar_t , into which the input will be placed. 
sl@0
  3046
 
sl@0
  3047
S  The same as ls.  
sl@0
  3048
c  Matches a sequence of width count wide characters (default 1); the next pointer must be a pointer to char , and there must be enough room for the multibyte representation of all the characters (no terminating NUL is added). The usual skip of leading white space is suppressed. To skip white space first, use an explicit space in the format. 
sl@0
  3049
If an l qualifier is present, the next pointer must be a pointer to wchar_t , into which the input will be placed. 
sl@0
  3050
 
sl@0
  3051
C  The same as lc.  
sl@0
  3052
[  Matches a nonempty sequence of characters from the specified set of accepted characters; the next pointer must be a pointer to char , and there must be enough room for the multibyte representation of all the characters in the string, plus a terminating NUL character. The usual skip of leading white space is suppressed. The string is to be made up of characters in (or not in) a particular set; the set is defined by the characters between the open bracket [ character and a close bracket ] character. The set excludes those characters if the first character after the open bracket is a circumflex ^. To include a close bracket in the set, make it the first character after the open bracket or the circumflex; any other position will end the set. To include a hyphen in the set, make it the last character before the final close bracket; some implementations of wscanf use "A-Z" to represent the range of characters between ‘A’ and ‘Z’. The string ends with the appearance of a character not in the (or, with a circumflex, in) set or when the field width runs out. 
sl@0
  3053
If an l qualifier is present, the next pointer must be a pointer to wchar_t , into which the input will be placed. 
sl@0
  3054
 
sl@0
  3055
p  Matches a pointer value (as printed by ‘%p’ in wprintf); the next pointer must be a pointer to void .  
sl@0
  3056
n  Nothing is expected; instead, the number of characters consumed thus far from the input is stored through the next pointer, which must be a pointer to int . This is not a conversion, although it can be suppressed with the * flag.  
sl@0
  3057
sl@0
  3058
sl@0
  3059
sl@0
  3060
The decimal point character is defined in the program’s locale (category LC_NUMERIC). 
sl@0
  3061
sl@0
  3062
For backwards compatibility, a "conversion" of ‘%\0’ causes an immediate return of EOF. 
sl@0
  3063
sl@0
  3064
@endcode
sl@0
  3065
sl@0
  3066
Examples:
sl@0
  3067
@code
sl@0
  3068
#include <stdio.h>
sl@0
  3069
#include <wchar.h>
sl@0
  3070
/* Illustrates how to use wscanf API */
sl@0
  3071
int example_wscanf(void)
sl@0
  3072
{
sl@0
  3073
  int rval;
sl@0
  3074
  int input;
sl@0
  3075
 /* Display a message to the user to input an integer */
sl@0
  3076
 wprintf(L"Enter an integer : ");
sl@0
  3077
  /* Read an integer from the standard input */
sl@0
  3078
  rval = wscanf(L"%d", &input;);
sl@0
  3079
 
sl@0
  3080
  /* return the number of inputs that were read */
sl@0
  3081
  return(rval);
sl@0
  3082
}
sl@0
  3083
sl@0
  3084
@endcode
sl@0
  3085
@code
sl@0
  3086
#include <stdio.h>
sl@0
  3087
#include <wchar.h>
sl@0
  3088
/* Illustrates how to use swscanf API */
sl@0
  3089
int example_swscanf(void)
sl@0
  3090
{
sl@0
  3091
  int rval;
sl@0
  3092
  wchar_t wcs[100];
sl@0
  3093
  wchar_t *bufptr = L"abcdefg";
sl@0
  3094
 /* Read a string from the buffer bufptr*/
sl@0
  3095
  rval = swscanf(bufptr, L"%s", wcs);
sl@0
  3096
 
sl@0
  3097
  /* The string that was read into wcs is printed */
sl@0
  3098
  wprintf(L"%s",wcs);
sl@0
  3099
 
sl@0
  3100
  /* return the number of inputs that were read */
sl@0
  3101
  return(rval);
sl@0
  3102
}
sl@0
  3103
sl@0
  3104
@endcode
sl@0
  3105
@code
sl@0
  3106
#include <stdio.h>
sl@0
  3107
#include <wchar.h>
sl@0
  3108
/* Illustrates how to use fwscanf API */
sl@0
  3109
int example_fwscanf(void)
sl@0
  3110
{
sl@0
  3111
  FILE *fp = NULL;
sl@0
  3112
  int retval;
sl@0
  3113
  wchar_t wcs[100];
sl@0
  3114
   
sl@0
  3115
  /* open the file for writing*/
sl@0
  3116
  fp = fopen("write.txt","w");
sl@0
  3117
  if(fp == NULL)
sl@0
  3118
  {
sl@0
  3119
    wprintf(L"Error: File open
sl@0
  3120
");
sl@0
  3121
    return (-1);
sl@0
  3122
  }
sl@0
  3123
 /* Read a string from fp*/
sl@0
  3124
  rval = fwscanf(fp, L"%s", wcs);
sl@0
  3125
 
sl@0
  3126
 /* Close the file that was opened */
sl@0
  3127
  fclose(fp);
sl@0
  3128
 
sl@0
  3129
  /* return the number of inputs that were read */
sl@0
  3130
  return(rval);
sl@0
  3131
}
sl@0
  3132
sl@0
  3133
@endcode
sl@0
  3134
@code
sl@0
  3135
#include <stdio.h>
sl@0
  3136
#include <wchar.h>
sl@0
  3137
/* Illustrates how to use vwscanf API */
sl@0
  3138
int example_vwscanf(va_list arg)
sl@0
  3139
{
sl@0
  3140
  int retval;
sl@0
  3141
    
sl@0
  3142
 /* Read a string from standard input */
sl@0
  3143
  rval = vwscanf(L"%s", arg);
sl@0
  3144
 
sl@0
  3145
  /* return the number of inputs that were read */
sl@0
  3146
  return(rval);
sl@0
  3147
}
sl@0
  3148
sl@0
  3149
@endcode
sl@0
  3150
@code
sl@0
  3151
#include <stdio.h>
sl@0
  3152
#include <wchar.h>
sl@0
  3153
/* Illustrates how to use vswscanf API */
sl@0
  3154
int example_vswscanf(va_list arg)
sl@0
  3155
{
sl@0
  3156
  int retval;
sl@0
  3157
  wchar_t bufptr = L"abc";
sl@0
  3158
    
sl@0
  3159
 /* Read a string from bufptr */
sl@0
  3160
  rval = vswscanf(bufptr, L"%s", arg);
sl@0
  3161
 
sl@0
  3162
  /* return the number of inputs that were read */
sl@0
  3163
  return(rval);
sl@0
  3164
}
sl@0
  3165
sl@0
  3166
@endcode
sl@0
  3167
@code
sl@0
  3168
#include <stdio.h>
sl@0
  3169
#include <wchar.h>
sl@0
  3170
/* Illustrates how to use vfwscanf API */
sl@0
  3171
int example_vfwscanf(va_list arg)
sl@0
  3172
{
sl@0
  3173
  FILE *fp = NULL;
sl@0
  3174
  int retval;
sl@0
  3175
    
sl@0
  3176
  /* open the file for writing*/
sl@0
  3177
  fp = fopen("write.txt","w");
sl@0
  3178
  if(fp == NULL)
sl@0
  3179
  {
sl@0
  3180
    wprintf(L"Error: File open
sl@0
  3181
");
sl@0
  3182
    return (-1);
sl@0
  3183
  }
sl@0
  3184
 /* Read a string */
sl@0
  3185
  rval = vfwscanf(fp, L"%s", arg);
sl@0
  3186
 
sl@0
  3187
  /* Close the file that was opened */
sl@0
  3188
  fclose(fp);
sl@0
  3189
 
sl@0
  3190
  /* return the number of inputs that were read */
sl@0
  3191
  return(rval);
sl@0
  3192
}
sl@0
  3193
sl@0
  3194
@endcode
sl@0
  3195
Examples:
sl@0
  3196
@code
sl@0
  3197
#include <stdio.h>
sl@0
  3198
#include <wchar.h>
sl@0
  3199
/* Illustrates how to use wscanf API */
sl@0
  3200
int example_wscanf(void)
sl@0
  3201
{
sl@0
  3202
  int rval;
sl@0
  3203
  int input;
sl@0
  3204
 /* Display a message to the user to input an integer */
sl@0
  3205
 wprintf(L"Enter an integer : ");
sl@0
  3206
  /* Read an integer from the standard input */
sl@0
  3207
  rval = wscanf(L"%d", &input;);
sl@0
  3208
 
sl@0
  3209
  /* return the number of inputs that were read */
sl@0
  3210
  return(rval);
sl@0
  3211
}
sl@0
  3212
sl@0
  3213
@endcode
sl@0
  3214
@code
sl@0
  3215
#include <stdio.h>
sl@0
  3216
#include <wchar.h>
sl@0
  3217
/* Illustrates how to use swscanf API */
sl@0
  3218
int example_swscanf(void)
sl@0
  3219
{
sl@0
  3220
  int rval;
sl@0
  3221
  wchar_t wcs[100];
sl@0
  3222
  wchar_t *bufptr = L"abcdefg";
sl@0
  3223
 /* Read a string from the buffer bufptr*/
sl@0
  3224
  rval = swscanf(bufptr, L"%s", wcs);
sl@0
  3225
 
sl@0
  3226
  /* The string that was read into wcs is printed */
sl@0
  3227
  wprintf(L"%s",wcs);
sl@0
  3228
 
sl@0
  3229
  /* return the number of inputs that were read */
sl@0
  3230
  return(rval);
sl@0
  3231
}
sl@0
  3232
sl@0
  3233
@endcode
sl@0
  3234
@code
sl@0
  3235
#include <stdio.h>
sl@0
  3236
#include <wchar.h>
sl@0
  3237
/* Illustrates how to use fwscanf API */
sl@0
  3238
int example_fwscanf(void)
sl@0
  3239
{
sl@0
  3240
  FILE *fp = NULL;
sl@0
  3241
  int retval;
sl@0
  3242
  wchar_t wcs[100];
sl@0
  3243
   
sl@0
  3244
  /* open the file for writing*/
sl@0
  3245
  fp = fopen("write.txt","w");
sl@0
  3246
  if(fp == NULL)
sl@0
  3247
  {
sl@0
  3248
    wprintf(L"Error: File open
sl@0
  3249
");
sl@0
  3250
    return (-1);
sl@0
  3251
  }
sl@0
  3252
 /* Read a string from fp*/
sl@0
  3253
  rval = fwscanf(fp, L"%s", wcs);
sl@0
  3254
 
sl@0
  3255
 /* Close the file that was opened */
sl@0
  3256
  fclose(fp);
sl@0
  3257
 
sl@0
  3258
  /* return the number of inputs that were read */
sl@0
  3259
  return(rval);
sl@0
  3260
}
sl@0
  3261
sl@0
  3262
@endcode
sl@0
  3263
@code
sl@0
  3264
#include <stdio.h>
sl@0
  3265
#include <wchar.h>
sl@0
  3266
/* Illustrates how to use vwscanf API */
sl@0
  3267
int example_vwscanf(va_list arg)
sl@0
  3268
{
sl@0
  3269
  int retval;
sl@0
  3270
    
sl@0
  3271
 /* Read a string from standard input */
sl@0
  3272
  rval = vwscanf(L"%s", arg);
sl@0
  3273
 
sl@0
  3274
  /* return the number of inputs that were read */
sl@0
  3275
  return(rval);
sl@0
  3276
}
sl@0
  3277
sl@0
  3278
@endcode
sl@0
  3279
@code
sl@0
  3280
#include <stdio.h>
sl@0
  3281
#include <wchar.h>
sl@0
  3282
/* Illustrates how to use vswscanf API */
sl@0
  3283
int example_vswscanf(va_list arg)
sl@0
  3284
{
sl@0
  3285
  int retval;
sl@0
  3286
  wchar_t bufptr = L"abc";
sl@0
  3287
    
sl@0
  3288
 /* Read a string from bufptr */
sl@0
  3289
  rval = vswscanf(bufptr, L"%s", arg);
sl@0
  3290
 
sl@0
  3291
  /* return the number of inputs that were read */
sl@0
  3292
  return(rval);
sl@0
  3293
}
sl@0
  3294
sl@0
  3295
@endcode
sl@0
  3296
@code
sl@0
  3297
#include <stdio.h>
sl@0
  3298
#include <wchar.h>
sl@0
  3299
/* Illustrates how to use vfwscanf API */
sl@0
  3300
int example_vfwscanf(va_list arg)
sl@0
  3301
{
sl@0
  3302
  FILE *fp = NULL;
sl@0
  3303
  int retval;
sl@0
  3304
    
sl@0
  3305
  /* open the file for writing*/
sl@0
  3306
  fp = fopen("write.txt","w");
sl@0
  3307
  if(fp == NULL)
sl@0
  3308
  {
sl@0
  3309
    wprintf(L"Error: File open
sl@0
  3310
");
sl@0
  3311
    return (-1);
sl@0
  3312
  }
sl@0
  3313
 /* Read a string */
sl@0
  3314
  rval = vfwscanf(fp, L"%s", arg);
sl@0
  3315
 
sl@0
  3316
  /* Close the file that was opened */
sl@0
  3317
  fclose(fp);
sl@0
  3318
 
sl@0
  3319
  /* return the number of inputs that were read */
sl@0
  3320
  return(rval);
sl@0
  3321
}
sl@0
  3322
sl@0
  3323
@endcode
sl@0
  3324
sl@0
  3325
Limitations:
sl@0
  3326
sl@0
  3327
Long double length modifiers are not supported.
sl@0
  3328
sl@0
  3329
@see fgetwc()
sl@0
  3330
@see scanf()
sl@0
  3331
@see wcrtomb()
sl@0
  3332
@see wcstod()
sl@0
  3333
@see wcstol()
sl@0
  3334
@see wcstoul()
sl@0
  3335
@see wprintf()
sl@0
  3336
sl@0
  3337
sl@0
  3338
Bugs:
sl@0
  3339
sl@0
  3340
 In addition to the bugs documented in scanf , wscanf does not support the "A-Z"
sl@0
  3341
notation for specifying character ranges with the character
sl@0
  3342
class conversion (' \%[ ').
sl@0
  3343
sl@0
  3344
 
sl@0
  3345
sl@0
  3346
@publishedAll
sl@0
  3347
@externallyDefinedApi
sl@0
  3348
*/
sl@0
  3349
sl@0
  3350
sl@0
  3351
sl@0
  3352
/** @fn  wcstoq(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  3353
@param nptr
sl@0
  3354
@param endptr
sl@0
  3355
@param base
sl@0
  3356
sl@0
  3357
Refer to wcstol() for the documentation
sl@0
  3358
sl@0
  3359
@see strtol()
sl@0
  3360
@see strtoul()
sl@0
  3361
sl@0
  3362
sl@0
  3363
 
sl@0
  3364
sl@0
  3365
@publishedAll
sl@0
  3366
@externallyDefinedApi
sl@0
  3367
*/
sl@0
  3368
sl@0
  3369
sl@0
  3370
sl@0
  3371
/** @fn  wcstouq(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  3372
@param nptr
sl@0
  3373
@param endptr
sl@0
  3374
@param base
sl@0
  3375
sl@0
  3376
Refer to wcstol() for the documentation
sl@0
  3377
sl@0
  3378
@see strtol()
sl@0
  3379
@see strtoul()
sl@0
  3380
sl@0
  3381
sl@0
  3382
 
sl@0
  3383
sl@0
  3384
@publishedAll
sl@0
  3385
@externallyDefinedApi
sl@0
  3386
*/
sl@0
  3387
sl@0
  3388
sl@0
  3389
sl@0
  3390
/** @fn  wcswcs(const wchar_t *s, const wchar_t *find)
sl@0
  3391
@param s
sl@0
  3392
@param find
sl@0
  3393
sl@0
  3394
  The wcswcs() function locates the first occurrence of the wide-character 
sl@0
  3395
string pointed by s (excluding the terminating '\\0' character) in the wide-character 
sl@0
  3396
string pointed by find.
sl@0
  3397
sl@0
  3398
Examples:
sl@0
  3399
@code
sl@0
  3400
#include <wchar.h>
sl@0
  3401
/* Illustrates how to use wcswcs API */
sl@0
  3402
int example_wcswcs()
sl@0
  3403
{  
sl@0
  3404
  /* source wide character string */
sl@0
  3405
 wchar_t *buf[20] = { L"fkhsdf%%38",L"rtti123123", };
sl@0
  3406
 wchar_t *str  = wcswcs(buf[0],L"\0");
sl@0
  3407
 wchar_t *str1 = wcswcs(buf[1],L"\0");
sl@0
  3408
 if(wcscmp(str,buf[0]))
sl@0
  3409
   return 1;
sl@0
  3410
 if(wcscmp(str1,buf[1]))
sl@0
  3411
   return 1
sl@0
  3412
 return 0;
sl@0
  3413
}
sl@0
  3414
sl@0
  3415
@endcode
sl@0
  3416
@return   The wcswcs() on success returns a pointer to the located wide-character string and returns
sl@0
  3417
a NULL pointer if the wide-charcter string was not found. If find is a wide-character string with length as zero, the function returns s.
sl@0
  3418
sl@0
  3419
@see strstr()
sl@0
  3420
sl@0
  3421
sl@0
  3422
 
sl@0
  3423
sl@0
  3424
@publishedAll
sl@0
  3425
@externallyDefinedApi
sl@0
  3426
*/
sl@0
  3427
sl@0
  3428
sl@0
  3429
sl@0
  3430
/** @fn  getwc(FILE *stream)
sl@0
  3431
@param stream
sl@0
  3432
sl@0
  3433
Refer to fgetwc() for the documentation
sl@0
  3434
sl@0
  3435
@see ferror()
sl@0
  3436
@see fopen()
sl@0
  3437
@see fread()
sl@0
  3438
@see getc()
sl@0
  3439
@see putwc()
sl@0
  3440
@see ungetwc()
sl@0
  3441
sl@0
  3442
sl@0
  3443
 
sl@0
  3444
sl@0
  3445
@publishedAll
sl@0
  3446
@externallyDefinedApi
sl@0
  3447
*/
sl@0
  3448
sl@0
  3449
sl@0
  3450
sl@0
  3451
/** @fn  getwchar(void); 
sl@0
  3452
sl@0
  3453
sl@0
  3454
Refer to fgetwc() for the documentation
sl@0
  3455
sl@0
  3456
@see ferror()
sl@0
  3457
@see fopen()
sl@0
  3458
@see fread()
sl@0
  3459
@see getc()
sl@0
  3460
@see putwc()
sl@0
  3461
@see ungetwc()
sl@0
  3462
sl@0
  3463
sl@0
  3464
 
sl@0
  3465
sl@0
  3466
@publishedAll
sl@0
  3467
@externallyDefinedApi
sl@0
  3468
*/
sl@0
  3469
sl@0
  3470
sl@0
  3471
sl@0
  3472
/** @fn  putwc(wchar_t wc, FILE *stream)
sl@0
  3473
@param wc
sl@0
  3474
@param stream
sl@0
  3475
sl@0
  3476
Refer to fputwc() for the documentation
sl@0
  3477
sl@0
  3478
@see ferror()
sl@0
  3479
@see fopen()
sl@0
  3480
@see getwc()
sl@0
  3481
@see putc()
sl@0
  3482
sl@0
  3483
sl@0
  3484
 
sl@0
  3485
sl@0
  3486
@publishedAll
sl@0
  3487
@externallyDefinedApi
sl@0
  3488
*/
sl@0
  3489
sl@0
  3490
sl@0
  3491
sl@0
  3492
/** @fn  putwchar(wchar_t wc)
sl@0
  3493
@param wc
sl@0
  3494
sl@0
  3495
Refer to fputwc() for the documentation
sl@0
  3496
sl@0
  3497
@see ferror()
sl@0
  3498
@see fopen()
sl@0
  3499
@see getwc()
sl@0
  3500
@see putc()
sl@0
  3501
sl@0
  3502
sl@0
  3503
 
sl@0
  3504
sl@0
  3505
@publishedAll
sl@0
  3506
@externallyDefinedApi
sl@0
  3507
*/
sl@0
  3508
sl@0
  3509
sl@0
  3510
sl@0
  3511
/** @fn  vfwscanf(FILE *  stream, const wchar_t *  format, va_list ap)
sl@0
  3512
@param stream
sl@0
  3513
@param format
sl@0
  3514
@param ap
sl@0
  3515
sl@0
  3516
Refer to wscanf() for the documentation
sl@0
  3517
sl@0
  3518
@see fgetwc()
sl@0
  3519
@see scanf()
sl@0
  3520
@see wcrtomb()
sl@0
  3521
@see wcstod()
sl@0
  3522
@see wcstol()
sl@0
  3523
@see wcstoul()
sl@0
  3524
@see wprintf()
sl@0
  3525
sl@0
  3526
sl@0
  3527
 
sl@0
  3528
sl@0
  3529
@publishedAll
sl@0
  3530
@externallyDefinedApi
sl@0
  3531
*/
sl@0
  3532
sl@0
  3533
sl@0
  3534
sl@0
  3535
/** @fn  vswscanf(const wchar_t *  str, const wchar_t *fmt, va_list ap)
sl@0
  3536
@param str
sl@0
  3537
@param fmt
sl@0
  3538
@param ap
sl@0
  3539
sl@0
  3540
Refer to wscanf() for the documentation
sl@0
  3541
sl@0
  3542
@see fgetwc()
sl@0
  3543
@see scanf()
sl@0
  3544
@see wcrtomb()
sl@0
  3545
@see wcstod()
sl@0
  3546
@see wcstol()
sl@0
  3547
@see wcstoul()
sl@0
  3548
@see wprintf()
sl@0
  3549
sl@0
  3550
sl@0
  3551
 
sl@0
  3552
sl@0
  3553
@publishedAll
sl@0
  3554
@externallyDefinedApi
sl@0
  3555
*/
sl@0
  3556
sl@0
  3557
sl@0
  3558
sl@0
  3559
/** @fn  vwscanf(const wchar_t *fmt, va_list ap)
sl@0
  3560
@param fmt
sl@0
  3561
@param ap
sl@0
  3562
sl@0
  3563
Refer to wscanf() for the documentation
sl@0
  3564
sl@0
  3565
@see fgetwc()
sl@0
  3566
@see scanf()
sl@0
  3567
@see wcrtomb()
sl@0
  3568
@see wcstod()
sl@0
  3569
@see wcstol()
sl@0
  3570
@see wcstoul()
sl@0
  3571
@see wprintf()
sl@0
  3572
sl@0
  3573
sl@0
  3574
 
sl@0
  3575
sl@0
  3576
@publishedAll
sl@0
  3577
@externallyDefinedApi
sl@0
  3578
*/
sl@0
  3579
sl@0
  3580
sl@0
  3581
sl@0
  3582
/** @fn  wcstof(const wchar_t *  nptr, wchar_t **  endptr)
sl@0
  3583
@param nptr
sl@0
  3584
@param endptr
sl@0
  3585
sl@0
  3586
Note: This description also covers the following functions -
sl@0
  3587
 wcstold()  wcstod() 
sl@0
  3588
sl@0
  3589
@return  
sl@0
  3590
sl@0
  3591
  The wcstof , wcstod and wcstold functions are the wide-character versions of the strtof , strtod and strtold functions.
sl@0
  3592
Refer to  strtod() for details.
sl@0
  3593
sl@0
  3594
Examples:
sl@0
  3595
@code
sl@0
  3596
#include <wchar.h>
sl@0
  3597
/* Illustrates how to use wcstof API */
sl@0
  3598
int example_wcstof()
sl@0
  3599
{  
sl@0
  3600
  /* src string */
sl@0
  3601
  wchar_t wcs1[21] = L"  1.23abcd";
sl@0
  3602
  wchar_t wcs2[5]=L"abcd";
sl@0
  3603
  wchar_t *eptr;
sl@0
  3604
  float d;
sl@0
  3605
  
sl@0
  3606
 /* convert wide-char string to float */  
sl@0
  3607
  d = wcstof(wcs1, &eptr;);
sl@0
  3608
 
sl@0
  3609
  /* compare the result */
sl@0
  3610
  if((d == 1.23F) && !(wcscmp (eptr, wcs2)))
sl@0
  3611
   return 0;
sl@0
  3612
  else
sl@0
  3613
   return 1;
sl@0
  3614
}
sl@0
  3615
sl@0
  3616
@endcode
sl@0
  3617
@code
sl@0
  3618
#include <wchar.h>
sl@0
  3619
/* Illustrates how to use wcstold API */
sl@0
  3620
int example_wcstold()
sl@0
  3621
{  
sl@0
  3622
  /* src string */
sl@0
  3623
  wchar_t wcs1[21] = L"  1.23abcd";
sl@0
  3624
  wchar_t wcs2[5]=L"abcd";
sl@0
  3625
  wchar_t *eptr;
sl@0
  3626
  double d;
sl@0
  3627
 
sl@0
  3628
  /* convert wide-char string to double */
sl@0
  3629
  d = wcstod(wcs1, &eptr;);
sl@0
  3630
 
sl@0
  3631
  /* compare the result */
sl@0
  3632
  if((d == 1.23) && !(wcscmp (eptr, wcs2)))
sl@0
  3633
   return 0;
sl@0
  3634
  else
sl@0
  3635
   return 1;
sl@0
  3636
}
sl@0
  3637
sl@0
  3638
@endcode
sl@0
  3639
@code
sl@0
  3640
#include <wchar.h>
sl@0
  3641
/* Illustrates how to use wcstold API */
sl@0
  3642
int example_wcstold()
sl@0
  3643
{  
sl@0
  3644
  /* src string */
sl@0
  3645
  wchar_t wcs1[21] = L"  1.23abcd";
sl@0
  3646
  wchar_t wcs2[5]=L"abcd";
sl@0
  3647
  wchar_t *eptr;
sl@0
  3648
  long double d;
sl@0
  3649
  
sl@0
  3650
  /* convert wide-char string to long double */
sl@0
  3651
  d = wcstold(wcs1, &eptr;);
sl@0
  3652
 
sl@0
  3653
  /* compare the result *
sl@0
  3654
  if((d == 1.23) && !(wcscmp (eptr, wcs2)))
sl@0
  3655
   return 0;
sl@0
  3656
  else
sl@0
  3657
  return 1;
sl@0
  3658
}
sl@0
  3659
sl@0
  3660
@endcode
sl@0
  3661
@see strtod()
sl@0
  3662
@see wcstol()
sl@0
  3663
sl@0
  3664
sl@0
  3665
 
sl@0
  3666
sl@0
  3667
@publishedAll
sl@0
  3668
@externallyDefinedApi
sl@0
  3669
*/
sl@0
  3670
sl@0
  3671
sl@0
  3672
sl@0
  3673
/** @fn  wcstold(const wchar_t *  nptr, wchar_t **  endptr)
sl@0
  3674
@param nptr
sl@0
  3675
@param endptr
sl@0
  3676
sl@0
  3677
Refer to wcstof() for the documentation
sl@0
  3678
sl@0
  3679
@see strtod()
sl@0
  3680
@see wcstol()
sl@0
  3681
sl@0
  3682
sl@0
  3683
 
sl@0
  3684
sl@0
  3685
@publishedAll
sl@0
  3686
@externallyDefinedApi
sl@0
  3687
*/
sl@0
  3688
sl@0
  3689
sl@0
  3690
sl@0
  3691
/** @fn  wcstoll(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  3692
@param nptr
sl@0
  3693
@param endptr
sl@0
  3694
@param base
sl@0
  3695
sl@0
  3696
Refer to wcstol() for the documentation
sl@0
  3697
sl@0
  3698
@see strtol()
sl@0
  3699
@see strtoul()
sl@0
  3700
sl@0
  3701
sl@0
  3702
 
sl@0
  3703
sl@0
  3704
@publishedAll
sl@0
  3705
@externallyDefinedApi
sl@0
  3706
*/
sl@0
  3707
sl@0
  3708
sl@0
  3709
sl@0
  3710
/** @fn  wcstoull(const wchar_t *  nptr, wchar_t **  endptr, int base)
sl@0
  3711
@param nptr
sl@0
  3712
@param endptr
sl@0
  3713
@param base
sl@0
  3714
sl@0
  3715
Refer to wcstol() for the documentation
sl@0
  3716
sl@0
  3717
@see strtol()
sl@0
  3718
@see strtoul()
sl@0
  3719
sl@0
  3720
sl@0
  3721
 
sl@0
  3722
sl@0
  3723
@publishedAll
sl@0
  3724
@externallyDefinedApi
sl@0
  3725
*/
sl@0
  3726
sl@0
  3727
sl@0
  3728
sl@0
  3729
/** @fn  wcswidth(const wchar_t *pwcs, size_t n)
sl@0
  3730
@param pwcs
sl@0
  3731
@param n
sl@0
  3732
@return   The wcswidth function returns 0 if pwcs is an empty string (L""), -1 if a non-printing wide character is 
sl@0
  3733
encountered or the number of column positions occupied otherwise.
sl@0
  3734
sl@0
  3735
  The wcswidth function determines the number of column positions required for the first n characters of pwcs ,
sl@0
  3736
or until a null wide character (L'\\0') is encountered.
sl@0
  3737
sl@0
  3738
 The behavior of the wcswdith is affected by LC_CTYPE category of the current locale.
sl@0
  3739
sl@0
  3740
Examples:
sl@0
  3741
@code
sl@0
  3742
#include <wchar.h>
sl@0
  3743
/* Illustrates how to use wcswidth API */
sl@0
  3744
int example_wcswidth()
sl@0
  3745
{  
sl@0
  3746
  /* wide character string for which width has to */
sl@0
  3747
  /* determined */
sl@0
  3748
  wchar_t *ws1 = L"test case";
sl@0
  3749
  int retval;
sl@0
  3750
  /* compute the width of the ws1 */
sl@0
  3751
  retval = wcswidth(ws1,50);
sl@0
  3752
 /* return the result */
sl@0
  3753
  return retval;
sl@0
  3754
}
sl@0
  3755
sl@0
  3756
@endcode
sl@0
  3757
sl@0
  3758
Limitations:
sl@0
  3759
sl@0
  3760
The current implementation of wcswidth is dependent upon locale support in Symbian OS.
sl@0
  3761
sl@0
  3762
@see iswprint()
sl@0
  3763
@see wcwidth()
sl@0
  3764
sl@0
  3765
sl@0
  3766
 
sl@0
  3767
sl@0
  3768
@publishedAll
sl@0
  3769
@externallyDefinedApi
sl@0
  3770
*/
sl@0
  3771
sl@0
  3772
sl@0
  3773
sl@0
  3774
/** @fn  wcwidth(wchar_t wc)
sl@0
  3775
@param wc
sl@0
  3776
@return   The wcwidth function returns 0 if the wc argument is a null wide character (L'\\0'), -1 if wc is not printable or the number of column positions the character occupies 
sl@0
  3777
otherwise.
sl@0
  3778
sl@0
  3779
  The wcwidth function determines the number of column positions required to
sl@0
  3780
display the wide character wc .
sl@0
  3781
sl@0
  3782
 The behavior of the wcwdith is affected by LC_CTYPE category of the current locale.
sl@0
  3783
sl@0
  3784
Examples:
sl@0
  3785
@code
sl@0
  3786
#include <wchar.h>
sl@0
  3787
/* Illustrates how to use wcwidth API */
sl@0
  3788
int example_wcwidth()
sl@0
  3789
{  
sl@0
  3790
 /* wide character for which width has to be determined */
sl@0
  3791
 wchar_t wc = L'a';
sl@0
  3792
 int retval;
sl@0
  3793
 /* determine the width of wc */
sl@0
  3794
 retval = wcwidth(wc);
sl@0
  3795
 /* return the determined width */
sl@0
  3796
 return retval;
sl@0
  3797
}
sl@0
  3798
sl@0
  3799
@endcode
sl@0
  3800
sl@0
  3801
Examples:
sl@0
  3802
sl@0
  3803
 This code fragment reads text from standard input and
sl@0
  3804
breaks lines that are more than 20 column positions wide,
sl@0
  3805
similar to the fold utility:
sl@0
  3806
@code
sl@0
  3807
wint_t ch;
sl@0
  3808
int column, w;
sl@0
  3809
column = 0;
sl@0
  3810
while ((ch = getwchar()) != WEOF) {
sl@0
  3811
        w = wcwidth(ch);
sl@0
  3812
        if (w > 0 && column + w >= 20) {
sl@0
  3813
                putwchar(L' \en');
sl@0
  3814
                column = 0;
sl@0
  3815
        }
sl@0
  3816
        putwchar(ch);
sl@0
  3817
        if (ch == L' \en')
sl@0
  3818
                column = 0;
sl@0
  3819
        else if (w > 0)
sl@0
  3820
                column += w;
sl@0
  3821
}
sl@0
  3822
sl@0
  3823
@endcode
sl@0
  3824
sl@0
  3825
Limitations:
sl@0
  3826
sl@0
  3827
The current implementation of wcwidth is dependent upon the locale support of Symbian OS.
sl@0
  3828
sl@0
  3829
@see iswprint()
sl@0
  3830
@see wcswidth()
sl@0
  3831
sl@0
  3832
sl@0
  3833
 
sl@0
  3834
sl@0
  3835
@publishedAll
sl@0
  3836
@externallyDefinedApi
sl@0
  3837
*/
sl@0
  3838
sl@0
  3839
sl@0
  3840
sl@0
  3841
/** @fn  mbsnrtowcs(wchar_t *  dst, const char **  src, size_t nms, size_t len, mbstate_t *  ps)
sl@0
  3842
@param dst
sl@0
  3843
@param src
sl@0
  3844
@param nms
sl@0
  3845
@param len
sl@0
  3846
@param ps
sl@0
  3847
sl@0
  3848
Refer to mbsrtowcs() for the documentation
sl@0
  3849
sl@0
  3850
@see mbrtowc()
sl@0
  3851
@see mbstowcs()
sl@0
  3852
@see wcsrtombs()
sl@0
  3853
sl@0
  3854
sl@0
  3855
 
sl@0
  3856
sl@0
  3857
@publishedAll
sl@0
  3858
@externallyDefinedApi
sl@0
  3859
*/
sl@0
  3860
sl@0
  3861
sl@0
  3862
sl@0
  3863
/** @fn  wcsnrtombs(char *  dst, const wchar_t **  src, size_t nwc, size_t len, mbstate_t * ps)
sl@0
  3864
@param dst
sl@0
  3865
@param src
sl@0
  3866
@param nwc
sl@0
  3867
@param len
sl@0
  3868
@param ps
sl@0
  3869
sl@0
  3870
Refer to wcsrtombs() for the documentation
sl@0
  3871
sl@0
  3872
@see mbsrtowcs()
sl@0
  3873
@see wcrtomb()
sl@0
  3874
@see wcstombs()
sl@0
  3875
sl@0
  3876
sl@0
  3877
 
sl@0
  3878
sl@0
  3879
@publishedAll
sl@0
  3880
@externallyDefinedApi
sl@0
  3881
*/
sl@0
  3882
sl@0
  3883
sl@0
  3884
sl@0
  3885
/** @fn  wcpcpy(wchar_t *dst , const wchar_t *src)
sl@0
  3886
@param dst
sl@0
  3887
@param src
sl@0
  3888
@return   The wcpcpy() function returns a pointer to the end of the wide-character 
sl@0
  3889
string dest , that is the return pointer points to the terminating '\\0'.
sl@0
  3890
sl@0
  3891
sl@0
  3892
sl@0
  3893
  The wcpcpy() function
sl@0
  3894
copies the wide-character string src to dst (including the terminating '\\0'
sl@0
  3895
character.)
sl@0
  3896
sl@0
  3897
sl@0
  3898
sl@0
  3899
Examples:
sl@0
  3900
@code
sl@0
  3901
#include <stdlib.h>
sl@0
  3902
#include <wchar.h>
sl@0
  3903
/* Illustrates how to use wcpcpy API */
sl@0
  3904
int example_wcpcpy()
sl@0
  3905
{ 
sl@0
  3906
  /* input string for which length to be found */
sl@0
  3907
 wchar_t *src = L"testcase";
sl@0
  3908
  wchar_t *dest = NULL;
sl@0
  3909
  wchar_t *destEndPtr = NULL; 
sl@0
  3910
    
sl@0
  3911
  /* allocate memory for the destination string */
sl@0
  3912
  dest = (wchar_t *)malloc((wcslen(src)+1)*sizeof(wchar_t));
sl@0
  3913
    
sl@0
  3914
  /*  perform the operation */
sl@0
  3915
  if(dest != NULL)
sl@0
  3916
   destEndPtr = (wchar_t *)wcpcpy(dest,src);
sl@0
  3917
  else
sl@0
  3918
   return 1;
sl@0
  3919
  if(!wcscmp(dest,src))
sl@0
  3920
  {
sl@0
  3921
   free(dest);
sl@0
  3922
   return 0;
sl@0
  3923
  }
sl@0
  3924
  else
sl@0
  3925
  {
sl@0
  3926
   free(dest);
sl@0
  3927
   return 1;
sl@0
  3928
  }
sl@0
  3929
}
sl@0
  3930
sl@0
  3931
@endcode
sl@0
  3932
 
sl@0
  3933
 
sl@0
  3934
sl@0
  3935
@publishedAll
sl@0
  3936
@externallyDefinedApi
sl@0
  3937
*/
sl@0
  3938
sl@0
  3939
sl@0
  3940
sl@0
  3941
/** @fn  wcpncpy(wchar_t *dst , const wchar_t *src, size_t n)
sl@0
  3942
@param dst
sl@0
  3943
@param src
sl@0
  3944
@param n
sl@0
  3945
@return   The wcpncpy() function returns a pointer to the wide character one past
sl@0
  3946
the last non-null wide character written.
sl@0
  3947
sl@0
  3948
  The wcpncpy() function copies at most n wide characters from the wide-character string src , including the terminating L'\\0' character, to dst . Exactly n wide characters are written at dst . If the length wcslen(src) is less than n , the remaining wide characters in the array dst are filled with L'\\0' 
sl@0
  3949
characters. If the length wcslen(src) is greater than or equal to n , the string dst will not be L'\\0' terminated.
sl@0
  3950
sl@0
  3951
Examples:
sl@0
  3952
@code
sl@0
  3953
#include <stdlib.h>
sl@0
  3954
#include <wchar.h>
sl@0
  3955
/* Illustrates how to use wcpncpy API */
sl@0
  3956
int example_wcpncpy(void)
sl@0
  3957
{ 
sl@0
  3958
  /* input string for which length to be found */
sl@0
  3959
 wchar_t *src = L"testcase";
sl@0
  3960
  wchar_t *dest = NULL;
sl@0
  3961
  wchar_t *destEndPtr = NULL; 
sl@0
  3962
    
sl@0
  3963
  /* allocate memory for the destination string */
sl@0
  3964
  dest = (wchar_t *)malloc((wcslen(src)+1)*sizeof(wchar_t));
sl@0
  3965
    
sl@0
  3966
  /*  perform the operation */
sl@0
  3967
  if(dest != NULL)
sl@0
  3968
   destEndPtr = (wchar_t *)wcpncpy(dest,src,wcslen(src)+1);
sl@0
  3969
  else
sl@0
  3970
   return -1;
sl@0
  3971
  /* checking for error */
sl@0
  3972
  if(!wcscmp(dest,src))
sl@0
  3973
  {
sl@0
  3974
   wprintf(L"wcpncpy succeeded
sl@0
  3975
");
sl@0
  3976
   free(dest);
sl@0
  3977
   return 0;
sl@0
  3978
  }
sl@0
  3979
  else
sl@0
  3980
  {
sl@0
  3981
   wprintf(L"wcpncpy failed!!
sl@0
  3982
");
sl@0
  3983
   free(dest);
sl@0
  3984
   return -1;
sl@0
  3985
  }
sl@0
  3986
}
sl@0
  3987
sl@0
  3988
@endcode
sl@0
  3989
@see wcpcpy()
sl@0
  3990
sl@0
  3991
sl@0
  3992
 
sl@0
  3993
sl@0
  3994
@publishedAll
sl@0
  3995
@externallyDefinedApi
sl@0
  3996
*/
sl@0
  3997
sl@0
  3998
sl@0
  3999
sl@0
  4000
/** @fn  wcscasecmp(const wchar_t *s1, const wchar_t *s2)
sl@0
  4001
@param s1
sl@0
  4002
@param s2
sl@0
  4003
@return   The wcscasecmp() returns an integer greater than, equal to, or less than 
sl@0
  4004
0, according as s1 is lexicographically greater than, equal to, or less than s2 after translation of each corresponding character to lower-case. The 
sl@0
  4005
strings themselves are not modified.
sl@0
  4006
sl@0
  4007
  The wcscasecmp() function
sl@0
  4008
compares the null-terminated wide-character strings s1 and s2 .
sl@0
  4009
sl@0
  4010
Examples:
sl@0
  4011
@code
sl@0
  4012
#include <wchar.h>
sl@0
  4013
/* Illustrates how to use wcscasecmp API */
sl@0
  4014
int example_wcscasecmp(void)
sl@0
  4015
{ 
sl@0
  4016
  /* input strings which needs to be compared */
sl@0
  4017
 wchar_t *ws1=L"testcasecmp";
sl@0
  4018
  wchar_t *ws2=L"TESTCASECMP";
sl@0
  4019
    
sl@0
  4020
  /* function call to compare the two strings which */
sl@0
  4021
  /* differ in case */
sl@0
  4022
  int retval = wcscasecmp(ws1,ws2);
sl@0
  4023
  /* returns 0 if they are equal or > 1 */
sl@0
  4024
  /* if first string is greater than second string else -1 */
sl@0
  4025
  return retval;
sl@0
  4026
}
sl@0
  4027
sl@0
  4028
@endcode
sl@0
  4029
@see strcasecmp()
sl@0
  4030
sl@0
  4031
sl@0
  4032
 
sl@0
  4033
sl@0
  4034
@publishedAll
sl@0
  4035
@externallyDefinedApi
sl@0
  4036
*/
sl@0
  4037
sl@0
  4038
sl@0
  4039
sl@0
  4040
/** @fn  wcsdup(const wchar_t *srcwcs)
sl@0
  4041
@param srcwcs
sl@0
  4042
@return   The wcsdup function returns a pointer to the new wide-character string, or NULL if sufficient memory was not available.
sl@0
  4043
sl@0
  4044
  The wcsdup() function allocates sufficient memory for a
sl@0
  4045
copy of the wide-string srcwcs, does the copy,
sl@0
  4046
and returns a pointer to it.  The pointer may
sl@0
  4047
subsequently be used as an argument to the function free .
sl@0
  4048
sl@0
  4049
 If insufficient memory is available, NULL is returned and errno is set to
sl@0
  4050
ENOMEM.
sl@0
  4051
sl@0
  4052
Examples:
sl@0
  4053
@code
sl@0
  4054
#include <wchar.h>
sl@0
  4055
/* Illustrates how to use wcsdup API */
sl@0
  4056
int example_wcsdup(void)
sl@0
  4057
{ 
sl@0
  4058
  /* input string for which length has to be found */
sl@0
  4059
 wchar_t *srcws=L"testwcsdup";
sl@0
  4060
  wchar_t *destws = NULL;
sl@0
  4061
    
sl@0
  4062
 /* invoke the API wcsdup to duplicate the string */
sl@0
  4063
  destws = wcsdup(srcws);
sl@0
  4064
  /* return no error if src str and dest str are equal else return an error */   
sl@0
  4065
  if(!(wcscmp(srcws,destws)))
sl@0
  4066
  {
sl@0
  4067
    free(destws);
sl@0
  4068
   return 1;
sl@0
  4069
  }
sl@0
  4070
  else
sl@0
  4071
  {
sl@0
  4072
    free(destws);
sl@0
  4073
   return -1;
sl@0
  4074
  }
sl@0
  4075
}
sl@0
  4076
sl@0
  4077
@endcode
sl@0
  4078
@see strdup()
sl@0
  4079
sl@0
  4080
sl@0
  4081
 
sl@0
  4082
sl@0
  4083
@publishedAll
sl@0
  4084
@externallyDefinedApi
sl@0
  4085
*/
sl@0
  4086
sl@0
  4087
sl@0
  4088
sl@0
  4089
/** @fn  wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
sl@0
  4090
@param s1
sl@0
  4091
@param s2
sl@0
  4092
@param n
sl@0
  4093
@return   The wcsncasecmp() returns an integer greater than, equal to, or less than 0,
sl@0
  4094
according as s1 is lexicographically greater than, equal to, or less than s2 after translation of each corresponding character to lower-case.
sl@0
  4095
The strings themselves are not modified.
sl@0
  4096
sl@0
  4097
  The wcsncasecmp() function compares atmost n wide-characters from the null-terminated wide-character strings s1 and s2 .
sl@0
  4098
sl@0
  4099
Examples:
sl@0
  4100
@code
sl@0
  4101
#include <wchar.h>
sl@0
  4102
/* Illustrates how to use wcsncasecmp API */
sl@0
  4103
int example_wcsncasecmp()
sl@0
  4104
{ 
sl@0
  4105
  /* input strings which need to be compared */
sl@0
  4106
 wchar_t *ws1=L"testcasecmp";
sl@0
  4107
  wchar_t *ws2=L"TESTCASECMP";
sl@0
  4108
    
sl@0
  4109
  /* function call to compare the two strings which */
sl@0
  4110
  /* differ in case */
sl@0
  4111
  int retval = wcsncasecmp(ws1,ws2,11);
sl@0
  4112
  /* returns 0 if they are equal except the case or >1 */
sl@0
  4113
  /* if first string is greater than second string else -1 */
sl@0
  4114
  return retval;
sl@0
  4115
}
sl@0
  4116
sl@0
  4117
@endcode
sl@0
  4118
@see strncasecmp()
sl@0
  4119
sl@0
  4120
sl@0
  4121
 
sl@0
  4122
sl@0
  4123
@publishedAll
sl@0
  4124
@externallyDefinedApi
sl@0
  4125
*/
sl@0
  4126
sl@0
  4127
sl@0
  4128
sl@0
  4129
/** @fn  wcsnlen(const wchar_t *s, size_t maxlen)
sl@0
  4130
@param s
sl@0
  4131
@param maxlen
sl@0
  4132
sl@0
  4133
  The wcsnlen() function computes the length of the wide-character string s not including the terminating NUL character. It looks at only
sl@0
  4134
first maxlen wide-characters in s and never beyond s+maxlen.
sl@0
  4135
sl@0
  4136
Examples:
sl@0
  4137
@code
sl@0
  4138
#include <wchar.h>
sl@0
  4139
/* Illustrates how to use wcsnlen API */
sl@0
  4140
size_t example_wcsnlen()
sl@0
  4141
{ 
sl@0
  4142
  /* input string for which length to be found */
sl@0
  4143
 wchar_t *ws=L"testwcsnlen";
sl@0
  4144
    
sl@0
  4145
  /* find the length of the wide char string by */
sl@0
  4146
  /* calling wcsnlen */
sl@0
  4147
  size_t retval = wcsnlen(ws,14);
sl@0
  4148
 /* return the number of wide chars in the string */
sl@0
  4149
 /* if retval is less than 14 Else return 14 as the */
sl@0
  4150
 /* length of the string */
sl@0
  4151
 return retval;
sl@0
  4152
}
sl@0
  4153
sl@0
  4154
@endcode
sl@0
  4155
@return   The wcsnlen() returns the number of wide-characters that precede the terminating
sl@0
  4156
NUL character if it is less than maxlen or maxlen if there is a terminating NUL character among maxlen characters pointed by s.
sl@0
  4157
sl@0
  4158
@see strnlen()
sl@0
  4159
sl@0
  4160
sl@0
  4161
 
sl@0
  4162
sl@0
  4163
@publishedAll
sl@0
  4164
@externallyDefinedApi
sl@0
  4165
*/
sl@0
  4166
sl@0
  4167
sl@0
  4168
sl@0
  4169
/** @fn  wrealpath(const wchar_t *path, wchar_t *resolved)
sl@0
  4170
@param path
sl@0
  4171
@param resolved
sl@0
  4172
@return   The wrealpath function returns resolved path on success.
sl@0
  4173
If an error occurs, wrealpath returns NULL, and resolved path contains the path which caused the problem.
sl@0
  4174
sl@0
  4175
@code
sl@0
  4176
  The wrealpath function resolves all extra "/"
sl@0
  4177
characters and references to /./ and /../ in path, and copies the resulting absolute path into
sl@0
  4178
the memory referenced by resolved path. The resolved path argument must refer to a buffer capable of storing at least PATH_MAX characters.
sl@0
  4179
sl@0
  4180
 The wrealpath function will resolve both absolute and relative paths
sl@0
  4181
and return the absolute path corresponding to path. All but the last component of path must exist when wrealpath is called.
sl@0
  4182
@endcode
sl@0
  4183
sl@0
  4184
sl@0
  4185
sl@0
  4186
Examples:
sl@0
  4187
@code
sl@0
  4188
#include<stdlib.h>
sl@0
  4189
#include<stdio.h> //printf
sl@0
  4190
#include<sys/stat.h> //S_IWUSR
sl@0
  4191
#include<sys/syslimits.h> //PATH_MAX
sl@0
  4192
#include<unistd.h> //chdir
sl@0
  4193
#inlclude<wchar.h>
sl@0
  4194
 
sl@0
  4195
int main()
sl@0
  4196
{
sl@0
  4197
 wchar_t resolvepath[PATH_MAX];
sl@0
  4198
 FILE *fp = NULL;
sl@0
  4199
 wchar_t *rpath = NULL;
sl@0
  4200
  
sl@0
  4201
 fp = wfopen(L"c:\xyz.txt", L"w");
sl@0
  4202
 if(!fp)
sl@0
  4203
 {
sl@0
  4204
     printf("wfopen failed!!");
sl@0
  4205
     return -1;
sl@0
  4206
 }
sl@0
  4207
    
sl@0
  4208
 wmkdir(L"c:\tmdir", S_IWUSR);
sl@0
  4209
  
sl@0
  4210
 int c = wchdir(L"c:\");
sl@0
  4211
 if(c == -1)
sl@0
  4212
 {
sl@0
  4213
     printf("wchdir failed!!");
sl@0
  4214
     return -1;
sl@0
  4215
 }
sl@0
  4216
  
sl@0
  4217
 rpath = wrealpath(L".\tmdir\..\xyz.txt", resolvepath);
sl@0
  4218
 printf("resolvepath: L%s
sl@0
  4219
", resolvepath);
sl@0
  4220
 if(rpath != NULL)
sl@0
  4221
    printf("rpath: L%s
sl@0
  4222
sl@0
  4223
", rpath);
sl@0
  4224
  
sl@0
  4225
 fclose(fp);
sl@0
  4226
 wrmdir(L"c:\tmdir");
sl@0
  4227
 wunlink(L"c:\xyz.txt");
sl@0
  4228
 return 0;
sl@0
  4229
}
sl@0
  4230
sl@0
  4231
@endcode
sl@0
  4232
 Output
sl@0
  4233
@code
sl@0
  4234
resolvepath: C:\xyz.txt
sl@0
  4235
rpath: C:\xyz.txt
sl@0
  4236
sl@0
  4237
@endcode
sl@0
  4238
 
sl@0
  4239
sl@0
  4240
@publishedAll
sl@0
  4241
@released
sl@0
  4242
*/
sl@0
  4243
sl@0
  4244
sl@0
  4245
sl@0
  4246
/** @fn  wrmdir(const wchar_t *_path)
sl@0
  4247
@param _path
sl@0
  4248
@return   The wrmdir() function returns the value 0 if successful; otherwise the
sl@0
  4249
value -1 is returned and the global variable errno is set to indicate the
sl@0
  4250
error.
sl@0
  4251
sl@0
  4252
  The wrmdir system call
sl@0
  4253
removes a directory file
sl@0
  4254
whose name is given by _path. The directory must not have any entries other
sl@0
  4255
than '.'
sl@0
  4256
and '..'.
sl@0
  4257
sl@0
  4258
Examples:
sl@0
  4259
@code
sl@0
  4260
/* Detailed description: This test code demonstrates usage of wrmdir systemcall, it removes directory
sl@0
  4261
 *  Example from the current working directory.
sl@0
  4262
 *
sl@0
  4263
 *  Preconditions: Expects empty directoy "Example" in current working directory.
sl@0
  4264
 */
sl@0
  4265
#include  <wchar.h>
sl@0
  4266
int main()
sl@0
  4267
{
sl@0
  4268
  if(wrmdir(L"Example") < 0 )  
sl@0
  4269
  {
sl@0
  4270
     printf("wrmdir failed 
sl@0
  4271
");
sl@0
  4272
     return -1;
sl@0
  4273
  }
sl@0
  4274
  printf("Directory Example removed 
sl@0
  4275
");
sl@0
  4276
  return 0;
sl@0
  4277
}
sl@0
  4278
sl@0
  4279
 Output
sl@0
  4280
Directory Example removed
sl@0
  4281
sl@0
  4282
@endcode
sl@0
  4283
sl@0
  4284
@code
sl@0
  4285
sl@0
  4286
@endcode
sl@0
  4287
sl@0
  4288
@capability Deferred @ref RFs::RmDir(const TDesC16&)
sl@0
  4289
sl@0
  4290
@publishedAll
sl@0
  4291
@released
sl@0
  4292
*/
sl@0
  4293
sl@0
  4294
sl@0
  4295
/** @fn  wstat(const wchar_t *name, struct stat *st)
sl@0
  4296
@param name
sl@0
  4297
@param st
sl@0
  4298
@return   Upon successful completion, the value 0 is returned; otherwise the
sl@0
  4299
value -1 is returned and the global variable errno is set to indicate the error.
sl@0
  4300
sl@0
  4301
sl@0
  4302
  The wstat system call obtains information about the file pointed to by name. Read, write or execute
sl@0
  4303
permission of the named file is not required, but all directories
sl@0
  4304
listed in the path name leading to the file must be searchable.
sl@0
  4305
sl@0
  4306
 The sb argument is a pointer to a stat structure as defined by \#include \<sys/stat.h\> and into which information is 
sl@0
  4307
  placed concerning the file.
sl@0
  4308
sl@0
  4309
 The fields of struct stat
sl@0
  4310
related to the file system are as follows: st_dev The numeric ID of the device containing the file. st_ino The file's inode number. st_nlink  The number of hard links to the file.
sl@0
  4311
sl@0
  4312
 The st_dev and st_ino fields together identify the file uniquely within the system.
sl@0
  4313
sl@0
  4314
 The time-related fields of struct stat
sl@0
  4315
are as follows: st_atime Time when file data last accessed.
sl@0
  4316
Changed by the .Xr utimes 2, read and readv system calls. st_mtime Time when file data last modified. st_ctime Time when file status was last changed (inode data modification). st_birthtime  Time when the inode was created.
sl@0
  4317
sl@0
  4318
 If _POSIX_SOURCE is not defined, the time-related fields are defined as: 
sl@0
  4319
@code
sl@0
  4320
#ifndef _POSIX_SOURCE
sl@0
  4321
#define st_atime st_atimespec.tv_sec
sl@0
  4322
#define st_mtime st_mtimespec.tv_sec
sl@0
  4323
#define st_ctime st_ctimespec.tv_sec
sl@0
  4324
#endif
sl@0
  4325
@endcode
sl@0
  4326
sl@0
  4327
 The size-related fields of the struct stat
sl@0
  4328
are as follows: st_size The file size in bytes. st_blksize  The optimal I/O block size for the file. st_blocks The actual number of blocks allocated for the file in 512-byte units.
sl@0
  4329
As short symbolic links are stored in the inode, this number may
sl@0
  4330
be zero.
sl@0
  4331
sl@0
  4332
 The access-related fields of struct stat
sl@0
  4333
are as follows: st_uid The user ID of the file's owner. st_gid The group ID of the file. st_mode  Status of the file (see below).
sl@0
  4334
sl@0
  4335
 The status information word st_mode has the following bits: 
sl@0
  4336
@code
sl@0
  4337
#define S_IFMT   0170000  // type of file 
sl@0
  4338
#define S_IFIFO  0010000  // named pipe (fifo) 
sl@0
  4339
#define S_IFCHR  0020000  // character special 
sl@0
  4340
#define S_IFDIR  0040000  // directory 
sl@0
  4341
#define S_IFBLK  0060000  // block special 
sl@0
  4342
#define S_IFREG  0100000  // regular 
sl@0
  4343
#define S_IFLNK  0120000  // symbolic link 
sl@0
  4344
#define S_IFSOCK 0140000  // socket 
sl@0
  4345
#define S_IFWHT  0160000  // whiteout 
sl@0
  4346
#define S_ISUID  0004000  // set user id on execution 
sl@0
  4347
#define S_ISGID  0002000  // set group id on execution 
sl@0
  4348
#define S_ISVTX  0001000  // save swapped text even after use 
sl@0
  4349
#define S_IRUSR  0000400  // read permission, owner 
sl@0
  4350
#define S_IWUSR  0000200  // write permission, owner 
sl@0
  4351
#define S_IXUSR  0000100  // execute/search permission, owner
sl@0
  4352
@endcode
sl@0
  4353
sl@0
  4354
@code
sl@0
  4355
For a list of access modes, see #include <sys/stat.h> The following macros are available 
sl@0
  4356
  to test whether a st_mode value passed in the m argument corresponds to a file of the specified type: 
sl@0
  4357
  S_ISBLK (m); Test for a block special file. 
sl@0
  4358
  S_ISCHR (m); Test for a character special file. 
sl@0
  4359
  S_ISDIR (m); Test for a directory. 
sl@0
  4360
  S_ISFIFO (m); Test for a pipe or FIFO special file. 
sl@0
  4361
  S_ISLNK (m); Test for a symbolic link. 
sl@0
  4362
  
sl@0
  4363
  NOTE: Inode structure is not supported by Symbian OS and hence link count updation is not possible.
sl@0
  4364
Check for symbolic link would always fail because of this reason. 
sl@0
  4365
sl@0
  4366
S_ISREG (m); Test for a regular file. 
sl@0
  4367
S_ISSOCK (m); Test for a socket. 
sl@0
  4368
S_ISWHT (m); Test for a whiteout.
sl@0
  4369
@endcode
sl@0
  4370
sl@0
  4371
 The macros evaluate to a non-zero value if the test is true or to the value 
sl@0
  4372
  0 if the test is false.
sl@0
  4373
sl@0
  4374
@code
sl@0
  4375
 st_dev The numeric ID of the device containing the file.
sl@0
  4376
 st_ino The file's inode number.
sl@0
  4377
 st_nlink
sl@0
  4378
  The number of hard links to the file.
sl@0
  4379
sl@0
  4380
@endcode
sl@0
  4381
@code
sl@0
  4382
 st_atime Time when file data last accessed.
sl@0
  4383
 Changed by the .Xr utimes 2, read and readv system calls.
sl@0
  4384
 st_mtime Time when file data last modified.
sl@0
  4385
 st_ctime Time when file status was last changed (inode data modification).
sl@0
  4386
 st_birthtime
sl@0
  4387
  Time when the inode was created.
sl@0
  4388
sl@0
  4389
@endcode
sl@0
  4390
@code
sl@0
  4391
 st_size The file size in bytes.
sl@0
  4392
 st_blksize
sl@0
  4393
  The optimal I/O block size for the file.
sl@0
  4394
 st_blocks The actual number of blocks allocated for the file in 512-byte units.
sl@0
  4395
 As short symbolic links are stored in the inode, this number may
sl@0
  4396
 be zero.
sl@0
  4397
sl@0
  4398
@endcode
sl@0
  4399
@code
sl@0
  4400
 st_uid The user ID of the file's owner.
sl@0
  4401
 st_gid The group ID of the file.
sl@0
  4402
 st_mode
sl@0
  4403
  Status of the file (see below).
sl@0
  4404
sl@0
  4405
@endcode
sl@0
  4406
@code
sl@0
  4407
 Test for a block special file.
sl@0
  4408
 Test for a character special file.
sl@0
  4409
 Test for a directory.
sl@0
  4410
 Test for a pipe or FIFO special file.
sl@0
  4411
 Test for a symbolic link. NOTE: Inode structure is not supported by Symbian OS and hence link count updation is not possible.
sl@0
  4412
 Check for symbolic link would always fail because of this reason.
sl@0
  4413
 Test for a regular file.
sl@0
  4414
 Test for a socket.
sl@0
  4415
 Test for a whiteout.
sl@0
  4416
sl@0
  4417
@endcode
sl@0
  4418
sl@0
  4419
sl@0
  4420
Examples:
sl@0
  4421
@code
sl@0
  4422
/* Detailed description: Sample usage of wstat system call
sl@0
  4423
 * Preconditions: Example.txt file should be present in working directory
sl@0
  4424
 */
sl@0
  4425
#include <fcntl.h>
sl@0
  4426
#include <unistd.h>
sl@0
  4427
#include <sys/types.h>
sl@0
  4428
#include <sys/stat.h>
sl@0
  4429
#include <wchar.h>
sl@0
  4430
int main()
sl@0
  4431
{
sl@0
  4432
  struct stat buf;
sl@0
  4433
   if(wstat(L"Example.txt"  , &buf;) < 0 )
sl@0
  4434
   {
sl@0
  4435
      printf("Failed to wstat Example.txt 
sl@0
  4436
");
sl@0
  4437
      return -1;
sl@0
  4438
   }
sl@0
  4439
   printf("wstat system call succeded 
sl@0
  4440
");
sl@0
  4441
   return 0;
sl@0
  4442
 }
sl@0
  4443
sl@0
  4444
@endcode
sl@0
  4445
 Output
sl@0
  4446
@code
sl@0
  4447
wstat system call succeded
sl@0
  4448
sl@0
  4449
@endcode
sl@0
  4450
@see access()
sl@0
  4451
@see wchmod()
sl@0
  4452
@see chown()
sl@0
  4453
sl@0
  4454
sl@0
  4455
sl@0
  4456
@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
sl@0
  4457
sl@0
  4458
@publishedAll
sl@0
  4459
@released
sl@0
  4460
*/
sl@0
  4461
sl@0
  4462
sl@0
  4463
/** @fn  wstat64(const wchar_t *name, struct stat64 *st)
sl@0
  4464
@param name
sl@0
  4465
@param st
sl@0
  4466
@return   Upon successful completion, the value 0 is returned; otherwise the
sl@0
  4467
value -1 is returned and the global variable errno is set to indicate the error.
sl@0
  4468
sl@0
  4469
The wstat64() function is a 64-bit version of wstat.
sl@0
  4470
sl@0
  4471
@see wstat()
sl@0
  4472
sl@0
  4473
@publishedAll
sl@0
  4474
@released
sl@0
  4475
*/
sl@0
  4476
sl@0
  4477
/** @fn  wsystem(const wchar_t *cmd)
sl@0
  4478
@param cmd
sl@0
  4479
@return   The wsystem function
sl@0
  4480
returns the exit status of the child process as returned by
sl@0
  4481
process' exit reason
sl@0
  4482
or -1 if an error occurred when spawning a new process.
sl@0
  4483
sl@0
  4484
  The wsystem function
sl@0
  4485
spawns another process with the argument cmd. The calling process waits for the child process
sl@0
  4486
to finish executing.
sl@0
  4487
sl@0
  4488
 If cmd is a NULL pointer, wsystem will return non-zero to indicate that wsystem is suporrted
sl@0
  4489
and zero if it is not supported.
sl@0
  4490
sl@0
  4491
sl@0
  4492
sl@0
  4493
Examples:
sl@0
  4494
@code
sl@0
  4495
#include <stdlib.h>
sl@0
  4496
#include <stdio.h> //printf
sl@0
  4497
#include <wchar.h>
sl@0
  4498
 
sl@0
  4499
int main( void )
sl@0
  4500
{
sl@0
  4501
   int retVal = -1;
sl@0
  4502
  
sl@0
  4503
   printf( "Calling wsystem()...
sl@0
  4504
" );
sl@0
  4505
  
sl@0
  4506
   /* helloworld.exe is an executable that just prints
sl@0
  4507
    * "Hello world!" and it should be created before
sl@0
  4508
    * executing this example code.
sl@0
  4509
    */
sl@0
  4510
   retVal = wsystem(L"c:\sys\bin\helloworld.exe");
sl@0
  4511
   
sl@0
  4512
   /* Print the return value of wsystem() */
sl@0
  4513
   printf( "wsystem() returned: %d", retVal );
sl@0
  4514
   
sl@0
  4515
   return 0;
sl@0
  4516
}
sl@0
  4517
sl@0
  4518
@endcode
sl@0
  4519
 Output
sl@0
  4520
@code
sl@0
  4521
Calling wsystem()...
sl@0
  4522
wsystem() returned: -1
sl@0
  4523
sl@0
  4524
@endcode
sl@0
  4525
@see wpopen()
sl@0
  4526
sl@0
  4527
sl@0
  4528
 
sl@0
  4529
sl@0
  4530
@publishedAll
sl@0
  4531
@released
sl@0
  4532
*/
sl@0
  4533
sl@0
  4534
sl@0
  4535
sl@0
  4536
/** @fn  wunlink(const wchar_t *_path)
sl@0
  4537
@param _path
sl@0
  4538
@return   Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno set to indicate the error.
sl@0
  4539
sl@0
  4540
  The wunlink system call removes the link named by _path from its file system.
sl@0
  4541
sl@0
  4542
 Symbian OS simulates links so there is no reference count and files are unaware 
sl@0
  4543
  of links. Calling unlink on a file will always close the file, regardless of 
sl@0
  4544
  whether there is another link.
sl@0
  4545
sl@0
  4546
 The _path argument may not be a directory.
sl@0
  4547
sl@0
  4548
Examples:
sl@0
  4549
@code
sl@0
  4550
/*
sl@0
  4551
* Detailed description: Example to wunlink a link file
sl@0
  4552
* Precondition: A file by name "Link" should exist in
sl@0
  4553
*                c: drive.
sl@0
  4554
*/
sl@0
  4555
#include <wchar.h>
sl@0
  4556
#include <stdio.h>
sl@0
  4557
int main(void)
sl@0
  4558
{
sl@0
  4559
    if(wunlink(L"C:\Link"))
sl@0
  4560
    {
sl@0
  4561
         printf("wunlink on link file failed");
sl@0
  4562
    }
sl@0
  4563
    printf("wunlink on link file succeeded");
sl@0
  4564
}
sl@0
  4565
sl@0
  4566
@endcode
sl@0
  4567
 Output
sl@0
  4568
@code
sl@0
  4569
wunlink on link file succeeded.
sl@0
  4570
sl@0
  4571
@endcode
sl@0
  4572
@see close()
sl@0
  4573
@see rmdir()
sl@0
  4574
sl@0
  4575
sl@0
  4576
sl@0
  4577
@capability Deferred @ref RFs::Att(const TDesC16&, unsigned&)
sl@0
  4578
@capability Deferred @ref RFs::SetAtt(const TDesC16&, unsigned, unsigned)
sl@0
  4579
@capability Deferred @ref RFs::Delete(const TDesC16&)
sl@0
  4580
sl@0
  4581
@publishedAll
sl@0
  4582
@released
sl@0
  4583
*/
sl@0
  4584
sl@0
  4585
sl@0
  4586
sl@0
  4587
/** @fn  wpopen(const wchar_t* command, const wchar_t* wmode )
sl@0
  4588
@param command
sl@0
  4589
@param wmode
sl@0
  4590
@return   The wpopen function returns NULL if the fork
sl@0
  4591
or pipe calls fail,
sl@0
  4592
or if it cannot allocate memory. And returns stream pointer on success.
sl@0
  4593
sl@0
  4594
  The wpopen function opens a process by creating a pipe and invoking the shell (creating a process). Since a pipe is by definition unidirectional, The wmode argument may specify only reading or writing, not both; the resulting stream is correspondingly read-only ("r") or write-only "w". If type is anything other than this, then the behavior is undefined.
sl@0
  4595
sl@0
  4596
 The command argument is a pointer to a null-terminated wide character string containing a shell command line.
sl@0
  4597
This command is passed to /bin/sh using the - c flag; interpretation, if any, is performed by the shell.
sl@0
  4598
sl@0
  4599
 The return value from wpopen is a normal standard I/O stream in all respects
sl@0
  4600
save that it must be closed with pclose rather than fclose. Writing to such a stream
sl@0
  4601
writes to the standard input of the command;
sl@0
  4602
the command's standard output is the same as that of the process that called wpopen, unless this is altered by the command itself.
sl@0
  4603
Conversely, reading from a "wpopened"
sl@0
  4604
stream reads the command's standard output, and
sl@0
  4605
the command's standard input is the same as that of the process that called wpopen.
sl@0
  4606
sl@0
  4607
 Note that output wpopen streams are fully buffered by default.
sl@0
  4608
sl@0
  4609
sl@0
  4610
sl@0
  4611
@see popen()
sl@0
  4612
@see pclose()
sl@0
  4613
@see pipe()
sl@0
  4614
@see fclose()
sl@0
  4615
@see fflush()
sl@0
  4616
@see fopen()
sl@0
  4617
@see system()
sl@0
  4618
sl@0
  4619
sl@0
  4620
Bugs:
sl@0
  4621
sl@0
  4622
 Since the standard input of a command opened for reading
sl@0
  4623
shares its seek offset with the process that called wpopen, if the original process has done a buffered read,
sl@0
  4624
the command's input position may not be as expected.
sl@0
  4625
Similarly, the output from a command opened for writing
sl@0
  4626
may become intermingled with that of the original process.
sl@0
  4627
The latter can be avoided by calling fflush before wpopen. Failure to execute the shell
sl@0
  4628
is indistinguishable from the shell's failure to execute command,
sl@0
  4629
or an immediate exit of the command.
sl@0
  4630
The only hint is an exit status of 127. The wpopen function always calls sh, never calls csh. 
sl@0
  4631
 
sl@0
  4632
sl@0
  4633
@publishedAll
sl@0
  4634
@released
sl@0
  4635
*/
sl@0
  4636
sl@0
  4637
sl@0
  4638
sl@0
  4639
/** @fn  wopen(const wchar_t *file, int flags, ...)
sl@0
  4640
@param file
sl@0
  4641
@param flags
sl@0
  4642
@param ...
sl@0
  4643
@return   If successful, wopen returns a non-negative integer, termed a file descriptor.
sl@0
  4644
It returns -1 on failure, and sets errno to indicate the error.
sl@0
  4645
sl@0
  4646
  The wide character file-name specified by the wide character string file is opened
sl@0
  4647
for reading and/or writing as specified by the
sl@0
  4648
argument flags and the file descriptor returned to the calling process.
sl@0
  4649
The flags argument may indicate the file is to be
sl@0
  4650
created if it does not exist (by specifying the O_CREAT flag).
sl@0
  4651
In this case wopen requires a third argument mode_t mode ,
sl@0
  4652
and the file is created with mode mode as described in chmod and modified by the process' umask value (see umask
sl@0
  4653
sl@0
  4654
sl@0
  4655
sl@0
  4656
 The flags specified are formed by or 'ing the following values
sl@0
  4657
sl@0
  4658
@code
sl@0
  4659
 O_RDONLYopen for reading only
sl@0
  4660
O_WRONLYopen for writing only
sl@0
  4661
O_RDWRopen for reading and writing
sl@0
  4662
O_APPENDappend on each write
sl@0
  4663
O_CREATcreate file if it does not exist
sl@0
  4664
O_TRUNCtruncate size to 0
sl@0
  4665
O_EXCLerror if create and file exists
sl@0
  4666
@endcode
sl@0
  4667
sl@0
  4668
 Opening a file with O_APPEND set causes each write on the file
sl@0
  4669
to be appended to the end.
sl@0
  4670
If O_TRUNC is specified and the
sl@0
  4671
file exists, the file is truncated to zero length.
sl@0
  4672
If O_EXCL is set with O_CREAT and the file already
sl@0
  4673
exists, wopen returns an error.
sl@0
  4674
This may be used to
sl@0
  4675
implement a simple exclusive access locking mechanism.
sl@0
  4676
If O_EXCL is set and the last component of the path is
sl@0
  4677
a symbolic link, wopen will fail even if the symbolic
sl@0
  4678
link points to a non-existent name.
sl@0
  4679
sl@0
  4680
sl@0
  4681
sl@0
  4682
 If successful, wopen returns a non-negative integer, termed a file descriptor.
sl@0
  4683
It returns -1 on failure.
sl@0
  4684
The file pointer used to mark the current position within the
sl@0
  4685
file is set to the beginning of the file.
sl@0
  4686
sl@0
  4687
 When a new file is created it is given the group of the directory
sl@0
  4688
which contains it.
sl@0
  4689
sl@0
  4690
 The new descriptor is set to remain wopen across execve system calls; see close and fcntl .
sl@0
  4691
sl@0
  4692
 The system imposes a limit on the number of file descriptors
sl@0
  4693
wopen simultaneously by one process.
sl@0
  4694
The getdtablesize system call returns the current system limit.
sl@0
  4695
sl@0
  4696
sl@0
  4697
sl@0
  4698
 
sl@0
  4699
sl@0
  4700
 Notes:
sl@0
  4701
sl@0
  4702
@code
sl@0
  4703
1) Mode values for group and others are ignored
sl@0
  4704
sl@0
  4705
 2) Execute bit and setuid on exec bit are ignored.
sl@0
  4706
sl@0
  4707
 3) The default working directory of a process is initalized to C: \p rivate \U ID 
sl@0
  4708
  (UID of the calling application) and any data written into this directory persists 
sl@0
  4709
  between phone resets.
sl@0
  4710
sl@0
  4711
 4) If the specified file is a symbolic link and the file it is pointing to 
sl@0
  4712
  is invalid, the symbolic link file will be automatically removed.
sl@0
  4713
sl@0
  4714
 5) A file in cannot be created with write-only permissions. Attempting to create 
sl@0
  4715
  a file with write-only permissions will result in a file with read-write permission.
sl@0
  4716
sl@0
  4717
 6) Creating a new file with the O_CREAT flag does not alter the time stamp 
sl@0
  4718
  of the parent directory.
sl@0
  4719
sl@0
  4720
 7) A file has only two time stamps: access and modification. Creation time 
sl@0
  4721
  stamp of the file is not supported and access time stamp is initially set equal 
sl@0
  4722
  to modification time stamp.
sl@0
  4723
@endcode
sl@0
  4724
sl@0
  4725
Examples:
sl@0
  4726
@code
sl@0
  4727
/*This example creates a file in the current working directory and
sl@0
  4728
 * opens it in read-write mode.
sl@0
  4729
 */
sl@0
  4730
#include <sys/types.h>
sl@0
  4731
#include <sys/stat.h>
sl@0
  4732
#include <wchar.h>
sl@0
  4733
int main()
sl@0
  4734
{
sl@0
  4735
  int fd = 0 ;
sl@0
  4736
   fd = wopen(L"Example.txt" , O_CREAT | O_EXCL , 0666) ;
sl@0
  4737
   if(fd < 0 ) 
sl@0
  4738
   {
sl@0
  4739
      printf("Failed to create and wopen file in current working directory 
sl@0
  4740
") ;
sl@0
  4741
      return -1 ;
sl@0
  4742
   }
sl@0
  4743
   printf("File created and opened in current working directory 
sl@0
  4744
"  ) ;
sl@0
  4745
   return 0 ;
sl@0
  4746
}
sl@0
  4747
sl@0
  4748
@endcode
sl@0
  4749
 Output
sl@0
  4750
@code
sl@0
  4751
File created and opened in current working directory
sl@0
  4752
sl@0
  4753
@endcode
sl@0
  4754
@see chmod()
sl@0
  4755
@see close()
sl@0
  4756
@see dup()
sl@0
  4757
@see getdtablesize()
sl@0
  4758
@see lseek()
sl@0
  4759
@see read()
sl@0
  4760
@see umask()
sl@0
  4761
@see write()
sl@0
  4762
@see fopen()
sl@0
  4763
@see open()
sl@0
  4764
sl@0
  4765
sl@0
  4766
sl@0
  4767
@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
sl@0
  4768
sl@0
  4769
@publishedAll
sl@0
  4770
@released
sl@0
  4771
*/
sl@0
  4772
sl@0
  4773
/** @fn  wopen64(const wchar_t *file, int flags, ...)
sl@0
  4774
@param file
sl@0
  4775
@param flags
sl@0
  4776
@param ...
sl@0
  4777
@return   If successful, wopen returns a non-negative integer, termed a file descriptor.
sl@0
  4778
It returns -1 on failure, and sets errno to indicate the error.
sl@0
  4779
sl@0
  4780
The wopen64() function is a 64-bit version of wopen.
sl@0
  4781
sl@0
  4782
@see wopen()
sl@0
  4783
sl@0
  4784
@publishedAll
sl@0
  4785
@released
sl@0
  4786
*/
sl@0
  4787
sl@0
  4788
sl@0
  4789
/** @fn  wfopen(const wchar_t *file, const wchar_t *mode)
sl@0
  4790
@param file
sl@0
  4791
@param mode
sl@0
  4792
@return   Upon successful completion wfopen returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
sl@0
  4793
sl@0
  4794
@code
sl@0
  4795
 "r" Open text file for reading.
sl@0
  4796
 The stream is positioned at the beginning of the file.
sl@0
  4797
 "r+" Open for reading and writing.
sl@0
  4798
 The stream is positioned at the beginning of the file.
sl@0
  4799
 "w" Truncate to zero length or create text file for writing.
sl@0
  4800
 The stream is positioned at the beginning of the file.
sl@0
  4801
 "w+" Open for reading and writing.
sl@0
  4802
 The file is created if it does not exist, otherwise it is truncated.
sl@0
  4803
 The stream is positioned at the beginning of the file.
sl@0
  4804
 "a" Open for writing.
sl@0
  4805
 The file is created if it does not exist.
sl@0
  4806
 The stream is positioned at the end of the file.
sl@0
  4807
 Subsequent writes to the file will always end up at the then current
sl@0
  4808
 end of file, irrespective of any intervening fseek or similar.
sl@0
  4809
 "a+" Open for reading and writing.
sl@0
  4810
 The file is created if it does not exist.
sl@0
  4811
 The stream is positioned at the end of the file.
sl@0
  4812
 Subsequent writes to the file will always end up at the then current
sl@0
  4813
 end of file, irrespective of any intervening fseek or similar.
sl@0
  4814
sl@0
  4815
@endcode
sl@0
  4816
  
sl@0
  4817
sl@0
  4818
 The mode string can also include the letter "b" either as a third character or
sl@0
  4819
as a character between the characters in any of the two-character strings described above.
sl@0
  4820
This is strictly for compatibility with -isoC and has no effect; the "b" is ignored.
sl@0
  4821
sl@0
  4822
 Reads and writes may be intermixed on read/write streams in any order,
sl@0
  4823
and do not require an intermediate seek as in previous versions of stdio. This is not portable to other systems, however; ANSI C requires that
sl@0
  4824
a file positioning function intervene between output and input, unless
sl@0
  4825
an input operation encounters end-of-file.
sl@0
  4826
sl@0
  4827
sl@0
  4828
sl@0
  4829
Examples:
sl@0
  4830
@code
sl@0
  4831
/* this program shows opening  in write mode,write data and close */
sl@0
  4832
/* again open in append mode and write data */
sl@0
  4833
/* Check file c:\wfopen.txt */
sl@0
  4834
#include <stdio.h>
sl@0
  4835
int main(void)
sl@0
  4836
        {
sl@0
  4837
        FILE *fp;       
sl@0
  4838
        wchar_t* name = L"c:\wfopen.txt";
sl@0
  4839
        if ((fp = wfopen (name, L"wb")) == NULL)
sl@0
  4840
                {
sl@0
  4841
                printf("Error creating file");
sl@0
  4842
                return -1;
sl@0
  4843
                }
sl@0
  4844
        printf("Opened file 
sl@0
  4845
");
sl@0
  4846
        fprintf(fp, "This is the first line
sl@0
  4847
");
sl@0
  4848
        printf("Wrote to file
sl@0
  4849
");
sl@0
  4850
        fclose (fp);
sl@0
  4851
        printf("Closed file
sl@0
  4852
");
sl@0
  4853
        if ((fp = wfopen (name, L"a")) == NULL)
sl@0
  4854
                {
sl@0
  4855
                printf("Error opening file");
sl@0
  4856
                return -1;
sl@0
  4857
                }
sl@0
  4858
        printf("Opened file for appending
sl@0
  4859
");
sl@0
  4860
        fprintf(fp, "This is the second line
sl@0
  4861
");
sl@0
  4862
        fclose (fp);
sl@0
  4863
        printf("closed file, check output in c:\ wfopen.txt file
sl@0
  4864
");
sl@0
  4865
        wunlink(name);
sl@0
  4866
        return 0;
sl@0
  4867
}
sl@0
  4868
sl@0
  4869
@endcode
sl@0
  4870
 Output
sl@0
  4871
@code
sl@0
  4872
Opened file
sl@0
  4873
Wrote to file
sl@0
  4874
Closed file
sl@0
  4875
Opened file for appending
sl@0
  4876
closed file, check output in c:\ wfopen.txt file
sl@0
  4877
sl@0
  4878
@endcode
sl@0
  4879
sl@0
  4880
Errors:
sl@0
  4881
sl@0
  4882
[EINVAL] The mode argument to wfopen, was invalid.  
sl@0
  4883
The wfopen, functions may also fail and set errno for any of the errors specified for the routine malloc. The wfopen function may also fail and set errno for any of the errors specified for the routine wopen. 
sl@0
  4884
sl@0
  4885
Note:
sl@0
  4886
sl@0
  4887
@code
sl@0
  4888
 1) Mode values for group and others will be ignored for file creation,execute bit and setuid on exec bit on an file don't have any effect while file creation.
sl@0
  4889
 Default working directory of a process is initialized to C:\private\UID (UID of the calling application) and any data written into this directory persists between phone resets. 
sl@0
  4890
sl@0
  4891
 2) If the specified file is a symbolic link and the file it is pointing to 
sl@0
  4892
 is invalid the symbolic link file will be automatically removed.
sl@0
  4893
@endcode
sl@0
  4894
sl@0
  4895
Limitations:
sl@0
  4896
sl@0
  4897
A file in cannot be created with write-only permission and attempting to 
sl@0
  4898
create one will result in a file with read-write permission. Creating a new file 
sl@0
  4899
with the O_CREAT flag does not alter the time stamp of its parent directory. The 
sl@0
  4900
newly created entry has only two time stamps: access and modification. Creation 
sl@0
  4901
time stamp is not supported and access time stamp is initially equal to modification 
sl@0
  4902
time stamp. open, fclose and fflush.
sl@0
  4903
sl@0
  4904
@see open()
sl@0
  4905
@see fclose()
sl@0
  4906
@see fileno()
sl@0
  4907
@see fseek()
sl@0
  4908
@see fopen()
sl@0
  4909
sl@0
  4910
sl@0
  4911
sl@0
  4912
@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
sl@0
  4913
sl@0
  4914
@publishedAll
sl@0
  4915
@released
sl@0
  4916
*/
sl@0
  4917
sl@0
  4918
/** @fn  wfopen64(const wchar_t *file, const wchar_t *mode)
sl@0
  4919
@param file
sl@0
  4920
@param mode
sl@0
  4921
@return   Upon successful completion wfopen returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
sl@0
  4922
sl@0
  4923
The wfopen64() function is a 64-bit version of wfopen.
sl@0
  4924
sl@0
  4925
@see wfopen()
sl@0
  4926
sl@0
  4927
@publishedAll
sl@0
  4928
@released
sl@0
  4929
*/
sl@0
  4930
sl@0
  4931
sl@0
  4932
sl@0
  4933
/** @fn  wrename(const wchar_t *oldpath, const wchar_t *newpath)
sl@0
  4934
@param oldpath
sl@0
  4935
@param newpath
sl@0
  4936
@return   The wrename() function returns the value 0 if successful; otherwise it returns 
sl@0
  4937
-1 and sets the global variable errno to indicate the error.
sl@0
  4938
sl@0
  4939
  The wrename system call
sl@0
  4940
causes the link with the wide character name oldpath to be renamed with the wide character name newpath. If newpath exists, it is first removed.
sl@0
  4941
Both oldpath and newpath must be of the same type (that is, both directories or both
sl@0
  4942
non-directories), and must reside on the same file system.
sl@0
  4943
sl@0
  4944
 If the final component of from is a symbolic link the symbolic link is renamed, not the file or 
sl@0
  4945
  directory to which it points.
sl@0
  4946
sl@0
  4947
 If a file with a symbolic link pointing to it is renamed, then
sl@0
  4948
a subsequent open call on the symbolic link file would automatically remove the link file, i.e
sl@0
  4949
consider a symbolic file link.x pointing to a file abc.x. If the file abc.x is
sl@0
  4950
renamed to abcd.x then, a subsequent open call on link.x file would automatically remove link.x file.
sl@0
  4951
sl@0
  4952
 Notes:
sl@0
  4953
sl@0
  4954
 wrename fails if from and to are files and are in use (i.e. if any either of the files is open).
sl@0
  4955
sl@0
  4956
 Parent directory time stamps are uneffected.
sl@0
  4957
sl@0
  4958
 The new entry has only two time stamps: modification and access. The access 
sl@0
  4959
  time stamp is initially equal to modification time stamp.
sl@0
  4960
sl@0
  4961
sl@0
  4962
sl@0
  4963
Examples:
sl@0
  4964
@code
sl@0
  4965
/* Detailed description  : This sample code demonstrates usage of wrename system call.
sl@0
  4966
 * Preconditions : Example.cfg file should be present in the current working directory.
sl@0
  4967
 */
sl@0
  4968
#include <wchar.h>
sl@0
  4969
#include <stdio.h>
sl@0
  4970
int main()
sl@0
  4971
{
sl@0
  4972
  if(wrename(L"Example.txt" , L"Example2.txt") < 0 )  {
sl@0
  4973
     printf("Failed to wrename Example.txt
sl@0
  4974
");
sl@0
  4975
     return -1;
sl@0
  4976
  }
sl@0
  4977
  printf("wrename successful 
sl@0
  4978
");
sl@0
  4979
  return 0;
sl@0
  4980
}
sl@0
  4981
sl@0
  4982
@endcode
sl@0
  4983
 Output:
sl@0
  4984
@code
sl@0
  4985
wrename successful
sl@0
  4986
sl@0
  4987
@endcode
sl@0
  4988
sl@0
  4989
Errors:
sl@0
  4990
sl@0
  4991
The wrename system call will fail and neither of the argument files will be affected if: 
sl@0
  4992
[EINVAL] Invalid argument.  
sl@0
  4993
[ENAMETOOLONG]  A component of a path exceeded 255 characters.  
sl@0
  4994
[ENOENT]  The named file does not exist.  
sl@0
  4995
[EACCES]  Search permission is denied for a component of the path prefix.  
sl@0
  4996
[EACCES]  The from argument is a parent directory of to, or an attempt is made to wrename ‘.’ or ‘..’.  
sl@0
  4997
sl@0
  4998
sl@0
  4999
@see open()
sl@0
  5000
@see symlink()
sl@0
  5001
@see rename()
sl@0
  5002
sl@0
  5003
sl@0
  5004
sl@0
  5005
@capability Deferred @ref RFs::Rename(const TDesC& anOldName,const TDesC& aNewName)
sl@0
  5006
@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
sl@0
  5007
@capability Deferred @ref RFs::RmDir(const TDesC16&)
sl@0
  5008
@capability Deferred @ref RFs::SetAtt(const TDesC16&, unsigned, unsigned)
sl@0
  5009
@capability Deferred @ref RFs::Delete(const TDesC16&)
sl@0
  5010
sl@0
  5011
@publishedAll
sl@0
  5012
@released
sl@0
  5013
*/
sl@0
  5014
sl@0
  5015
sl@0
  5016
sl@0
  5017
/** @fn  wchdir(const wchar_t *_path)
sl@0
  5018
@param _path
sl@0
  5019
@return   Upon successful completion, the value 0 is returned; otherwise the
sl@0
  5020
value -1 is returned and the global variable errno is set to indicate the
sl@0
  5021
error.
sl@0
  5022
sl@0
  5023
  The _path argument points to the pathname of a directory which is a wide character string.
sl@0
  5024
The wchdir system call
sl@0
  5025
causes the named directory
sl@0
  5026
to become the current working directory, that is,
sl@0
  5027
the starting point for _path searches of pathnames not beginning with
sl@0
  5028
a slash, '/.'
sl@0
  5029
sl@0
  5030
sl@0
  5031
sl@0
  5032
Examples:
sl@0
  5033
@code
sl@0
  5034
#include<wchar.h>                       /* wmkdir, wrmdir */
sl@0
  5035
#include <sys/stat.h>                   /* S_IRWXU */
sl@0
  5036
#include <stdio.h>                      /* printf */
sl@0
  5037
int main()
sl@0
  5038
{
sl@0
  5039
        int ret_wmkdir = wmkdir(L"dirName", S_IRWXU);                   /* create directory */
sl@0
  5040
        if(ret_wmkdir < 0)
sl@0
  5041
                {
sl@0
  5042
                printf("error creating directory");
sl@0
  5043
                return -1;
sl@0
  5044
                }
sl@0
  5045
        else
sl@0
  5046
                {
sl@0
  5047
                int ret_wchdir = wchdir(L"dirName");                    /* change directory */
sl@0
  5048
                if(ret_wchdir < 0)
sl@0
  5049
                        {
sl@0
  5050
                        printf("error changing directory");
sl@0
  5051
                        return -1;
sl@0
  5052
                        }
sl@0
  5053
                else
sl@0
  5054
                        {
sl@0
  5055
                        printf("working directory changed");
sl@0
  5056
                        }
sl@0
  5057
                        wrmdir(L"dirname");                             /* remove directory */                  
sl@0
  5058
                }
sl@0
  5059
        return 0;                       
sl@0
  5060
}
sl@0
  5061
sl@0
  5062
@endcode
sl@0
  5063
 Output
sl@0
  5064
@code
sl@0
  5065
working directory changed
sl@0
  5066
sl@0
  5067
@endcode
sl@0
  5068
@see chdir()
sl@0
  5069
sl@0
  5070
sl@0
  5071
sl@0
  5072
@capability Deferred @ref RFs::Att(const TDesC16&, unsigned&)
sl@0
  5073
@capability Deferred @ref RFs::SetSessionPath(const TDesC16&)
sl@0
  5074
sl@0
  5075
@publishedAll
sl@0
  5076
@released
sl@0
  5077
*/
sl@0
  5078
sl@0
  5079
sl@0
  5080
sl@0
  5081
/** @fn  wchmod(const wchar_t *_path, mode_t _mode)
sl@0
  5082
@param _path
sl@0
  5083
@param _mode
sl@0
  5084
@return   Upon successful completion, the value 0 is returned; otherwise the
sl@0
  5085
value -1 is returned and the global variable errno is set to indicate the
sl@0
  5086
error.
sl@0
  5087
sl@0
  5088
  The file permission bits of the wide character file-name specified by _path are changed to _mode. The wchmod system call verifies that the process owner (user) either owns the file specified by _path is the super-user. 
sl@0
  5089
A mode is created from or’d permission bit masks defined in   \#include \<sys/stat.h\>:
sl@0
  5090
sl@0
  5091
@code
sl@0
  5092
#define S_IRWXU 0000700    // RWX mask for owner
sl@0
  5093
#define S_IRUSR 0000400    // R for owner 
sl@0
  5094
#define S_IWUSR 0000200    // W for owner 
sl@0
  5095
#define S_IXUSR 0000100    // X for owner 
sl@0
  5096
#define S_IRWXG 0000070    // RWX mask for group 
sl@0
  5097
#define S_IRGRP 0000040    // R for group 
sl@0
  5098
#define S_IWGRP 0000020    // W for group 
sl@0
  5099
#define S_IXGRP 0000010    // X for group 
sl@0
  5100
#define S_IRWXO 0000007    // RWX mask for other 
sl@0
  5101
#define S_IROTH 0000004    // R for other 
sl@0
  5102
#define S_IWOTH 0000002    // W for other 
sl@0
  5103
#define S_IXOTH 0000001    // X for other 
sl@0
  5104
#define S_ISUID 0004000    // set user id on execution 
sl@0
  5105
#define S_ISGID 0002000    // set group id on execution 
sl@0
  5106
#ifndef __BSD_VISIBLE
sl@0
  5107
#define S_ISTXT 0001000    // sticky bit 
sl@0
  5108
#endif
sl@0
  5109
@endcode
sl@0
  5110
sl@0
  5111
 Note : sticky bit and setuid on exec bit are not supported, permission values for users is considered while premissions values for group and others are ignored(As there is no concept of group and others). An attempt to change file permission to write-only changes the file permission to read-write. Permissions for directory will be ignored.
sl@0
  5112
sl@0
  5113
sl@0
  5114
Examples:
sl@0
  5115
@code
sl@0
  5116
#include <wchar.h>              /* wchmode, wfopen */
sl@0
  5117
#include <sys/stat.h>           /* S_IWUSR */
sl@0
  5118
#include <stdio.h>              /* printf */
sl@0
  5119
int main()
sl@0
  5120
{
sl@0
  5121
        FILE * wfp = wfopen(L"fileName.txt", L"wb");            /* create file */
sl@0
  5122
        if(wfp)
sl@0
  5123
                {
sl@0
  5124
                fclose(wfp);                                    /* close file */
sl@0
  5125
                int ret = wchmod(L"fileName", S_IWUSR);         /* change mode */
sl@0
  5126
                if(ret < 0)
sl@0
  5127
                        {
sl@0
  5128
                        printf("error changing mode");
sl@0
  5129
                        return -1;
sl@0
  5130
                        }
sl@0
  5131
                else
sl@0
  5132
                        {
sl@0
  5133
                        printf("mode changed");
sl@0
  5134
                        }
sl@0
  5135
                }
sl@0
  5136
        else
sl@0
  5137
        {
sl@0
  5138
        printf("error creating file");
sl@0
  5139
        return -1;
sl@0
  5140
        }
sl@0
  5141
        return 0;
sl@0
  5142
}
sl@0
  5143
sl@0
  5144
@endcode
sl@0
  5145
 Output
sl@0
  5146
@code
sl@0
  5147
mode changed
sl@0
  5148
sl@0
  5149
@endcode
sl@0
  5150
@see chmod()
sl@0
  5151
@see chown()
sl@0
  5152
@see open()
sl@0
  5153
@see stat()
sl@0
  5154
sl@0
  5155
sl@0
  5156
sl@0
  5157
@capability Deferred @ref RFs::SetAtt(const TDesC16&, unsigned, unsigned)
sl@0
  5158
sl@0
  5159
@publishedAll
sl@0
  5160
@released
sl@0
  5161
*/
sl@0
  5162
sl@0
  5163
sl@0
  5164
sl@0
  5165
/** @fn  wgetcwd(wchar_t *_buf, size_t _size)
sl@0
  5166
@param _buf
sl@0
  5167
@param _size
sl@0
  5168
@return   Upon successful completion, a pointer to the pathname is returned.
sl@0
  5169
Otherwise a NULL pointer is returned and the global variable errno is set to indicate the error.
sl@0
  5170
In addition, wgetcwd copies the error message associated with errno into the memory referenced by _buf.
sl@0
  5171
sl@0
  5172
  The wgetcwd function copies the absolute pathname of the current working directory
sl@0
  5173
into the memory referenced by _buf which is a wchar_t pointer
sl@0
  5174
and returns a pointer to _buf. The size argument is the _size, in bytes, of the array referenced by _buf.
sl@0
  5175
sl@0
  5176
 If _buf is NULL, space is allocated as indicated by size to store the pathname and the current working directory is
sl@0
  5177
returned as long as the _size bytes are sufficient to hold the working directory name.
sl@0
  5178
This space may later be free'd.
sl@0
  5179
sl@0
  5180
 This routine has traditionally been used by programs to save the
sl@0
  5181
name of a working directory for the purpose of returning to it.
sl@0
  5182
A much faster and less error-prone method of accomplishing this is to
sl@0
  5183
open the current directory ('.')
sl@0
  5184
and use the fchdir function to return.
sl@0
  5185
sl@0
  5186
Examples:
sl@0
  5187
@code
sl@0
  5188
#include<wchar.h>
sl@0
  5189
#include<stdio.h>
sl@0
  5190
#include <stdlib.h>
sl@0
  5191
#define BUF_SIZE 100
sl@0
  5192
  
sl@0
  5193
int main()
sl@0
  5194
{
sl@0
  5195
 int c;                 
sl@0
  5196
 long size = BUF_SIZE;
sl@0
  5197
 wchar_t *buf = NULL;
sl@0
  5198
 wchar_t *ptr = NULL;
sl@0
  5199
  
sl@0
  5200
 c = wchdir("c:\");            /* change directory to c: */
sl@0
  5201
  
sl@0
  5202
 buf = (wchar_t *)malloc((size_t)size);
sl@0
  5203
  
sl@0
  5204
 if (buf != NULL && c == 0)
sl@0
  5205
        {
sl@0
  5206
        ptr = wgetcwd(buf, (size_t)size);               /* call wgetcwd to fetch the current directory */
sl@0
  5207
        printf("wgetcwd returned: %s
sl@0
  5208
", ptr);
sl@0
  5209
        }
sl@0
  5210
 free(buf);
sl@0
  5211
 return 0;
sl@0
  5212
}
sl@0
  5213
sl@0
  5214
@endcode
sl@0
  5215
 Output
sl@0
  5216
@code
sl@0
  5217
wgetcwd returned: c:\
sl@0
  5218
sl@0
  5219
@endcode
sl@0
  5220
sl@0
  5221
Notes:
sl@0
  5222
sl@0
  5223
 The wgetcwd function returns the default working directory as c:\\private\\XXXXXXXX (where XXXXXXXX is the UID of the process) as the 
sl@0
  5224
default session path is initialised to c:\\private\\current_process'_UID in Symbian OS.
sl@0
  5225
sl@0
  5226
@see chdir()
sl@0
  5227
@see malloc()
sl@0
  5228
@see strerror()
sl@0
  5229
@see wgetcwd()
sl@0
  5230
sl@0
  5231
sl@0
  5232
 
sl@0
  5233
sl@0
  5234
@publishedAll
sl@0
  5235
@released
sl@0
  5236
*/
sl@0
  5237
sl@0
  5238
sl@0
  5239
sl@0
  5240
/** @fn  wmkdir(const wchar_t *_path, mode_t _mode)
sl@0
  5241
@param _path
sl@0
  5242
@param _mode
sl@0
  5243
@return   The wmkdir() function returns the value 0 if successful; otherwise the
sl@0
  5244
value -1 is returned and the global variable errno is set to indicate the
sl@0
  5245
error.
sl@0
  5246
sl@0
  5247
  The directory with the wide character name _path is created with the access permissions specified by _mode.
sl@0
  5248
sl@0
  5249
 Notes:
sl@0
  5250
sl@0
  5251
 mode is ignored.
sl@0
  5252
sl@0
  5253
 Parent directory time stamps are not updated.
sl@0
  5254
sl@0
  5255
Examples:
sl@0
  5256
@code
sl@0
  5257
#include <sys/stat.h>
sl@0
  5258
#include <wchar.h>
sl@0
  5259
#include <stdio.h>
sl@0
  5260
int main()
sl@0
  5261
{
sl@0
  5262
  if(wmkdir(L"Example" , 0666) < 0 )  
sl@0
  5263
  {
sl@0
  5264
      printf("Directory creation failed 
sl@0
  5265
");
sl@0
  5266
      return -1;
sl@0
  5267
  }
sl@0
  5268
  printf("Directory Example created 
sl@0
  5269
");
sl@0
  5270
  return 0;
sl@0
  5271
}
sl@0
  5272
sl@0
  5273
@endcode
sl@0
  5274
 Output
sl@0
  5275
@code
sl@0
  5276
Directory Example created
sl@0
  5277
sl@0
  5278
@endcode
sl@0
  5279
@see chmod()
sl@0
  5280
@see stat()
sl@0
  5281
@see umask()
sl@0
  5282
@see mkdir()
sl@0
  5283
sl@0
  5284
sl@0
  5285
sl@0
  5286
@capability Deferred @ref RFs::MkDir(const TDesC16&)
sl@0
  5287
sl@0
  5288
@publishedAll
sl@0
  5289
@released
sl@0
  5290
*/
sl@0
  5291
sl@0
  5292
sl@0
  5293
sl@0
  5294
/** @fn  wclosedir(WDIR *wdp)
sl@0
  5295
@param wdp
sl@0
  5296
@return   The wclosedir function returns 0 on success and on failure -1 is returned and the global variable errno is set to indicate the error..
sl@0
  5297
sl@0
  5298
 
sl@0
  5299
sl@0
  5300
 The wclosedir function closes the named directory stream and frees the structure associated with the dirp pointer.
sl@0
  5301
sl@0
  5302
sl@0
  5303
sl@0
  5304
Examples:
sl@0
  5305
@code
sl@0
  5306
/* Detailed description: This test code demonstrates usage of wclose  system call.*
sl@0
  5307
 * Preconditions: Expects Test directory to be present in current working directory.
sl@0
  5308
 */
sl@0
  5309
 #include <wchar.h>
sl@0
  5310
 #include <dirent.h>
sl@0
  5311
int main()
sl@0
  5312
{
sl@0
  5313
  WDIR *DirHandle;
sl@0
  5314
  if(!(DirHandle = wopendir(L"Test") ) )
sl@0
  5315
  {
sl@0
  5316
     printf("Failed to open directoy Test 
sl@0
  5317
");
sl@0
  5318
     return -1;
sl@0
  5319
  }
sl@0
  5320
  if(wclosedir(DirHandle) < 0 ) 
sl@0
  5321
  {
sl@0
  5322
     printf("Close dir failed 
sl@0
  5323
");
sl@0
  5324
     return -1;
sl@0
  5325
  }
sl@0
  5326
  printf("Directory Test closed 
sl@0
  5327
");
sl@0
  5328
  return 0;
sl@0
  5329
}
sl@0
  5330
sl@0
  5331
@endcode
sl@0
  5332
 Output
sl@0
  5333
@code
sl@0
  5334
Directory Test closed
sl@0
  5335
sl@0
  5336
@endcode
sl@0
  5337
@see wopendir()
sl@0
  5338
@see wreaddir()
sl@0
  5339
@see opendir()
sl@0
  5340
@see readdir()
sl@0
  5341
sl@0
  5342
sl@0
  5343
 
sl@0
  5344
sl@0
  5345
@publishedAll
sl@0
  5346
@released
sl@0
  5347
*/
sl@0
  5348
sl@0
  5349
sl@0
  5350
sl@0
  5351
/** @fn  wreaddir(WDIR *wdp)
sl@0
  5352
@param wdp
sl@0
  5353
@return   The wreaddir function returns a pointer to a wdirent structure,
sl@0
  5354
or NULL if an error occurs or end-of-file is reached.
sl@0
  5355
sl@0
  5356
 
sl@0
  5357
sl@0
  5358
 The wreaddir function
sl@0
  5359
returns a wdirent pointer to the next directory entry.
sl@0
  5360
It returns NULL upon reaching the end of the directory or detecting an invalid wreaddir operation on the directory stream. The new position reverts to the one associated with the directory stream when the wtelldir operation was performed.
sl@0
  5361
sl@0
  5362
 
sl@0
  5363
sl@0
  5364
 Note: wreaddir operates on a static directory structure created by wopendir . Asynchronous operations on the directory itself will not 
sl@0
  5365
  be reflected in calls to wreaddir .
sl@0
  5366
sl@0
  5367
sl@0
  5368
sl@0
  5369
Examples:
sl@0
  5370
@code
sl@0
  5371
 /* Detailed description: Sample usage of wreaddir call
sl@0
  5372
  * Preconditions:  Example Directory should be present in current working directory and should contain atleast one file/directory.
sl@0
  5373
  */
sl@0
  5374
#include <dirent.h>
sl@0
  5375
#include <unistd.h>
sl@0
  5376
#include <wchar.h>
sl@0
  5377
int main()
sl@0
  5378
{
sl@0
  5379
  WDIR *dirName;
sl@0
  5380
  struct wdirent *Dir;
sl@0
  5381
  dirName = wopendir(L"Example");
sl@0
  5382
  if(dirName == NULL )  {
sl@0
  5383
     printf("Failed to open directory 
sl@0
  5384
");
sl@0
  5385
     return -1;
sl@0
  5386
  }
sl@0
  5387
  if(!(Dir = wreaddir(dirName))  )  {
sl@0
  5388
    printf("Read dir failed  
sl@0
  5389
");
sl@0
  5390
    return -1;
sl@0
  5391
  }
sl@0
  5392
 printf("Directory Example read 
sl@0
  5393
");
sl@0
  5394
 wclosedir(dirName);
sl@0
  5395
 return 0;
sl@0
  5396
}
sl@0
  5397
sl@0
  5398
@endcode
sl@0
  5399
 Output
sl@0
  5400
@code
sl@0
  5401
Directory Example read
sl@0
  5402
sl@0
  5403
@endcode
sl@0
  5404
@see wopendir()
sl@0
  5405
@see wreaddir()
sl@0
  5406
@see wrewinddir()
sl@0
  5407
@see wtelldir()
sl@0
  5408
@see wseekdir()
sl@0
  5409
@see wclosedir()
sl@0
  5410
@see opendir()
sl@0
  5411
@see readdir()
sl@0
  5412
@see rewinddir()
sl@0
  5413
@see telldir()
sl@0
  5414
@see seekdir()
sl@0
  5415
@see closedir()
sl@0
  5416
@see close()
sl@0
  5417
@see lseek()
sl@0
  5418
@see open()
sl@0
  5419
@see read()
sl@0
  5420
sl@0
  5421
sl@0
  5422
 
sl@0
  5423
sl@0
  5424
@publishedAll
sl@0
  5425
@released
sl@0
  5426
*/
sl@0
  5427
sl@0
  5428
sl@0
  5429
/** @fn  wreaddir64(WDIR *wdp)
sl@0
  5430
@param wdp
sl@0
  5431
@return   The wreaddir64 function returns a pointer to a wdirent64 structure,
sl@0
  5432
or NULL if an error occurs or end-of-file is reached.
sl@0
  5433
sl@0
  5434
The wreaddir64() function is a 64-bit version of wreaddir.
sl@0
  5435
sl@0
  5436
@see wreaddir() 
sl@0
  5437
sl@0
  5438
@publishedAll
sl@0
  5439
@released
sl@0
  5440
*/
sl@0
  5441
sl@0
  5442
/** @fn  wrewinddir(WDIR *wdp)
sl@0
  5443
@param wdp
sl@0
  5444
@return   The wrewinddir function returns no value.
sl@0
  5445
sl@0
  5446
 
sl@0
  5447
sl@0
  5448
 The wrewinddir function
sl@0
  5449
function resets the position of the named directory stream pointed by 'dirp' to the beginning of the directory.
sl@0
  5450
sl@0
  5451
sl@0
  5452
sl@0
  5453
Examples:
sl@0
  5454
@code
sl@0
  5455
 /* Detailed description: Sample usage of wreaddir call
sl@0
  5456
  * Preconditions:  Example Directory should be present in current working directory and should contain say 4 files/directories.
sl@0
  5457
  */
sl@0
  5458
#include <dirent.h>
sl@0
  5459
#include <unistd.h>
sl@0
  5460
#include <wchar.h>
sl@0
  5461
int main()
sl@0
  5462
{
sl@0
  5463
  WDIR *dirName;
sl@0
  5464
  off_t offset;
sl@0
  5465
  struct wdirent *Dir;
sl@0
  5466
  dirName = wopendir(L"Example");
sl@0
  5467
  if(dirName == NULL )  {
sl@0
  5468
     printf("Failed to open directory 
sl@0
  5469
");
sl@0
  5470
     return -1;
sl@0
  5471
  }
sl@0
  5472
  wseekdir(dirName, 3)
sl@0
  5473
  if((offset = wtelldir(dirName))!= 3)  {
sl@0
  5474
    printf("failed  
sl@0
  5475
");
sl@0
  5476
    return -1;
sl@0
  5477
  }
sl@0
  5478
  wrewindir(dirName);
sl@0
  5479
  if((offset = wtelldir(dirName))!= 0)  {
sl@0
  5480
    printf("failed  
sl@0
  5481
");
sl@0
  5482
    return -1;
sl@0
  5483
  }
sl@0
  5484
 printf("Successful
sl@0
  5485
");
sl@0
  5486
 wclosedir(dirName);
sl@0
  5487
 return 0;
sl@0
  5488
}
sl@0
  5489
sl@0
  5490
@endcode
sl@0
  5491
 Output
sl@0
  5492
@code
sl@0
  5493
Successful
sl@0
  5494
sl@0
  5495
@endcode
sl@0
  5496
@see wreaddir()
sl@0
  5497
@see wtelldir()
sl@0
  5498
@see wseekdir()
sl@0
  5499
@see readdir()
sl@0
  5500
@see rewinddir()
sl@0
  5501
@see telldir()
sl@0
  5502
@see seekdir()
sl@0
  5503
sl@0
  5504
sl@0
  5505
 
sl@0
  5506
sl@0
  5507
@publishedAll
sl@0
  5508
@released
sl@0
  5509
*/
sl@0
  5510
sl@0
  5511
sl@0
  5512
sl@0
  5513
/** @fn  waccess(const wchar_t *fn, int flags)
sl@0
  5514
@param fn
sl@0
  5515
@param flags
sl@0
  5516
@return   Upon successful completion, the value 0 is returned; otherwise the
sl@0
  5517
value -1 is returned and the global variable errno is set to indicate the
sl@0
  5518
error.
sl@0
  5519
sl@0
  5520
  The waccess system call checks the accessibility of the
sl@0
  5521
file named by the fn argument for the access permissions indicated by the flags argument.
sl@0
  5522
The value of flags is either the bitwise-inclusive OR of the access permissions to be
sl@0
  5523
checked (R_OK for read permission, W_OK for write permission, and X_OK for execute/search permission),
sl@0
  5524
or the existence test ( F_OK. )
sl@0
  5525
sl@0
  5526
 For additional information, see the File access Permission
sl@0
  5527
section of intro . X_OK, the file may not actually have execute permission bits set.
sl@0
  5528
Likewise for R_OK and W_OK.
sl@0
  5529
sl@0
  5530
 Note that as execute-bit for files is not supported waccess system call for X_OK is undefined.
sl@0
  5531
sl@0
  5532
Examples:
sl@0
  5533
@code
sl@0
  5534
/* Detailed description: This sample code checks read-ok accessibility of file Example.c
sl@0
  5535
 * Precondtions: Example.txt file should be present in working directory.
sl@0
  5536
 */
sl@0
  5537
#include <unistd.h>
sl@0
  5538
#include <wchar.h>
sl@0
  5539
int main()
sl@0
  5540
{
sl@0
  5541
  if(waccess("Example.c" ,R_OK)  < 0)  
sl@0
  5542
  {
sl@0
  5543
    printf("Read operation on the file is not permitted 
sl@0
  5544
") ;
sl@0
  5545
    return -1 ;
sl@0
  5546
  }
sl@0
  5547
  printf("Read operation permitted on Example.c file 
sl@0
  5548
") ;
sl@0
  5549
  return 0 ;
sl@0
  5550
}
sl@0
  5551
sl@0
  5552
@endcode
sl@0
  5553
 Output
sl@0
  5554
@code
sl@0
  5555
Read operation permitted on Example.c file
sl@0
  5556
sl@0
  5557
@endcode
sl@0
  5558
@see wchmod()
sl@0
  5559
@see wstat()
sl@0
  5560
sl@0
  5561
sl@0
  5562
sl@0
  5563
@capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
sl@0
  5564
sl@0
  5565
@publishedAll
sl@0
  5566
@released
sl@0
  5567
*/
sl@0
  5568
sl@0
  5569
sl@0
  5570
sl@0
  5571
/** @fn  wcreat(const wchar_t *file, mode_t mode)
sl@0
  5572
@param file
sl@0
  5573
@param mode
sl@0
  5574
@return   wopen and wcreat return the new file descriptor, or -1 if an error occurred 
sl@0
  5575
  (in which case errno is set appropriately).
sl@0
  5576
sl@0
  5577
  This interface is made obsolete by: wopen
sl@0
  5578
sl@0
  5579
 The wcreat function
sl@0
  5580
is the same as: wopen(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
sl@0
  5581
sl@0
  5582
 Notes:
sl@0
  5583
sl@0
  5584
 Creating a new file doesn't alter the time stamp of the parent directory.
sl@0
  5585
sl@0
  5586
 The newly created entry has two time stamps: access and modification. Both 
sl@0
  5587
  are initially the same.
sl@0
  5588
sl@0
  5589
 Symbian OS does not support a creation time stamp.
sl@0
  5590
sl@0
  5591
sl@0
  5592
sl@0
  5593
Examples:
sl@0
  5594
@code
sl@0
  5595
/*
sl@0
  5596
 * Detailed description   : This test code demonstrates wcreat api usage, it creates a
sl@0
  5597
 * in current working directory(if file exists then it is truncated.
sl@0
  5598
 *Preconditions : None
sl@0
  5599
 */
sl@0
  5600
#include <sys/types.h>
sl@0
  5601
#include <sys/stat.h>
sl@0
  5602
#include <fcntl.h>
sl@0
  5603
#include <wchar.h>
sl@0
  5604
int main()
sl@0
  5605
{
sl@0
  5606
 int fd = 0;
sl@0
  5607
  fd = wcreat(L"Example.txt" , 0666);
sl@0
  5608
  if(fd < 0 )  
sl@0
  5609
  {
sl@0
  5610
    printf("File creation failed 
sl@0
  5611
");
sl@0
  5612
    return -1;
sl@0
  5613
  }
sl@0
  5614
  printf("Example.txt file created 
sl@0
  5615
");
sl@0
  5616
  return 0;
sl@0
  5617
}
sl@0
  5618
sl@0
  5619
@endcode
sl@0
  5620
 Output
sl@0
  5621
@code
sl@0
  5622
Example.txt file created
sl@0
  5623
sl@0
  5624
@endcode
sl@0
  5625
@see wopen()
sl@0
  5626
sl@0
  5627
sl@0
  5628
 
sl@0
  5629
sl@0
  5630
@publishedAll
sl@0
  5631
@released
sl@0
  5632
*/
sl@0
  5633
sl@0
  5634
/** @fn  wcreat64(const wchar_t *file, mode_t mode)
sl@0
  5635
@param file
sl@0
  5636
@param mode
sl@0
  5637
@return   wcreat64() return the new file descriptor, or -1 if an error occurred 
sl@0
  5638
  (in which case errno is set appropriately).
sl@0
  5639
sl@0
  5640
The wcreat64() function is a 64-bit version of wcreat.
sl@0
  5641
sl@0
  5642
@see wcreat()
sl@0
  5643
sl@0
  5644
@publishedAll
sl@0
  5645
@released
sl@0
  5646
*/
sl@0
  5647
sl@0
  5648
/** @fn  wseekdir(WDIR *wdp, off_t index)
sl@0
  5649
@param wdp
sl@0
  5650
@param index
sl@0
  5651
sl@0
  5652
Refer to wtelldir() for the documentation
sl@0
  5653
sl@0
  5654
@see wclosedir()
sl@0
  5655
@see wopendir()
sl@0
  5656
@see wreaddir()
sl@0
  5657
sl@0
  5658
sl@0
  5659
 
sl@0
  5660
sl@0
  5661
@publishedAll
sl@0
  5662
@released
sl@0
  5663
*/
sl@0
  5664
sl@0
  5665
sl@0
  5666
/** @fn  wcsupr(wchar_t *wcs)
sl@0
  5667
@param wcs
sl@0
  5668
sl@0
  5669
  The wcsupr() function
sl@0
  5670
converts each letter from the wide-character string wcs to upper-case.
sl@0
  5671
The conversion is determined by the LC_CTYPE category setting of the locale.
sl@0
  5672
Other characters are not affected. It returns a pointer to the altered string.
sl@0
  5673
Because the modification is done in place, the pointer returned is the same as
sl@0
  5674
the pointer passed as the input argument.
sl@0
  5675
sl@0
  5676
@return   The wcsupr() returns a pointer to the altered string, on successful conversion of wcs, else it returns NULL pointer.
sl@0
  5677
sl@0
  5678
Examples:
sl@0
  5679
@code
sl@0
  5680
#include <wchar.h>
sl@0
  5681
/* Illustrates how to use wcsupr API */
sl@0
  5682
int example_wcsupr(void)
sl@0
  5683
{ 
sl@0
  5684
  /* input string which needs to be converted to upper-case */
sl@0
  5685
  wchar_t src[9]=L"testcase";
sl@0
  5686
 
sl@0
  5687
  /* expected result string */
sl@0
  5688
  wchar_t *exp=L"TESTCASE";
sl@0
  5689
 
sl@0
  5690
  wchar_t *res = NULL;
sl@0
  5691
    
sl@0
  5692
  /* function call to convert the src to upper-case */
sl@0
  5693
  res = wcsupr(src);
sl@0
  5694
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
sl@0
  5695
  if( res != NULL && !wcscmp(res,exp))
sl@0
  5696
        return 0;
sl@0
  5697
  else
sl@0
  5698
        return -1;
sl@0
  5699
}
sl@0
  5700
sl@0
  5701
@endcode
sl@0
  5702
@see strupr()
sl@0
  5703
@see towupper()
sl@0
  5704
@see towlower()
sl@0
  5705
@see wcslwr()
sl@0
  5706
sl@0
  5707
sl@0
  5708
 
sl@0
  5709
sl@0
  5710
@publishedAll
sl@0
  5711
@released
sl@0
  5712
*/
sl@0
  5713
sl@0
  5714
/** @fn  wcslwr(wchar_t *wcs)
sl@0
  5715
@param wcs
sl@0
  5716
sl@0
  5717
  The wcslwr() function
sl@0
  5718
converts each letter from the wide-character string wcs to lower-case.
sl@0
  5719
The conversion is determined by the LC_CTYPE category setting of the locale.
sl@0
  5720
Other characters are not affected. It returns a pointer to the altered string.
sl@0
  5721
Because the modification is done in place, the pointer returned is the same as
sl@0
  5722
the pointer passed as the input argument.
sl@0
  5723
sl@0
  5724
@return   The wcslwr() returns a pointer to the altered string, on successful conversion of wcs, else it returns NULL pointer.
sl@0
  5725
sl@0
  5726
Examples:
sl@0
  5727
@code
sl@0
  5728
#include <wchar.h>
sl@0
  5729
/* Illustrates how to use wcslwr API */
sl@0
  5730
int example_wcslwr(void)
sl@0
  5731
{ 
sl@0
  5732
  /* input string which needs to be converted to lower-case */
sl@0
  5733
  wchar_t src[9]=L"TESTCASE";
sl@0
  5734
 
sl@0
  5735
  /* expected result string */
sl@0
  5736
  wchar_t *exp=L"testcase";
sl@0
  5737
 
sl@0
  5738
  wchar_t *res = NULL;
sl@0
  5739
    
sl@0
  5740
  /* function call to convert the src to lower-case */
sl@0
  5741
  res = wcslwr(src);
sl@0
  5742
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
sl@0
  5743
  if( res != NULL && !wcscmp(res,exp))
sl@0
  5744
        return 0;
sl@0
  5745
  else
sl@0
  5746
        return -1;
sl@0
  5747
}
sl@0
  5748
sl@0
  5749
@endcode
sl@0
  5750
@see strupr()
sl@0
  5751
@see strlwr()
sl@0
  5752
@see towupper()
sl@0
  5753
@see towlower()
sl@0
  5754
@see wcsupr()
sl@0
  5755
sl@0
  5756
sl@0
  5757
 
sl@0
  5758
sl@0
  5759
@publishedAll
sl@0
  5760
@released
sl@0
  5761
*/
sl@0
  5762
sl@0
  5763
/** @fn  wcsset(wchar_t *wcs, wchar_t wc)
sl@0
  5764
@param wcs
sl@0
  5765
@param wc
sl@0
  5766
sl@0
  5767
  The wcsset() function sets all the characters of the wide-character string wcs to the wide-character specified by wc, except the terminating null character. It returns a pointer to the altered string, which is same
sl@0
  5768
as the source string passed to wcsset as it is modified in place.
sl@0
  5769
sl@0
  5770
@return   The wcsset() returns a pointer to the altered string, on success, else it returns NULL pointer.
sl@0
  5771
sl@0
  5772
Examples:
sl@0
  5773
@code
sl@0
  5774
#include <wchar.h>
sl@0
  5775
/* Illustrates how to use wcsset API */
sl@0
  5776
int example_wcsset(void)
sl@0
  5777
{ 
sl@0
  5778
  /* input string which needs to be set to the character specified by wc. */
sl@0
  5779
  wchar_t wcs[9]=L"kohinoor";
sl@0
  5780
  wcgar_t wc = L'K';
sl@0
  5781
 
sl@0
  5782
  /* expected result string */
sl@0
  5783
  wchar_t *exp=L"KKKKKKKK";
sl@0
  5784
 
sl@0
  5785
  wchar_t *res = NULL;
sl@0
  5786
    
sl@0
  5787
  /* function call to set all the chars in wcs to wc*/
sl@0
  5788
  res = wcsset(wcs, wc);
sl@0
  5789
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
sl@0
  5790
  if( res != NULL && !wcscmp(res,exp))
sl@0
  5791
        return 0;
sl@0
  5792
  else
sl@0
  5793
        return -1;
sl@0
  5794
}
sl@0
  5795
sl@0
  5796
@endcode
sl@0
  5797
@see strset()
sl@0
  5798
@see wcsnset()
sl@0
  5799
sl@0
  5800
sl@0
  5801
 
sl@0
  5802
sl@0
  5803
@publishedAll
sl@0
  5804
@released
sl@0
  5805
*/
sl@0
  5806
sl@0
  5807
/** @fn  wcsnset(wchar_t *wcs, wchar_t wc, size_t maxSize)
sl@0
  5808
@param wcs
sl@0
  5809
@param wc
sl@0
  5810
@param maxSize
sl@0
  5811
sl@0
  5812
  The wcsnset() function sets first maxSize characters of the wide-character string wcs to the wide-character specified by wc. If maxSize is greater than the length of wcs, then length of wcs is used instead of maxSize.
sl@0
  5813
It returns a pointer to the altered string, which is same
sl@0
  5814
as the source string passed to wcsnset as it is modified in place.
sl@0
  5815
sl@0
  5816
@return   The wcsnset() returns a pointer to the altered string, on success, else it returns NULL pointer.
sl@0
  5817
sl@0
  5818
Examples:
sl@0
  5819
@code
sl@0
  5820
#include <wchar.h>
sl@0
  5821
/* Illustrates how to use wcsnset API */
sl@0
  5822
int example_wcsnset(void)
sl@0
  5823
{ 
sl@0
  5824
  /* input string which needs to be set to the character specified by wc. */
sl@0
  5825
  wchar_t wcs[9]=L"kohinoor";
sl@0
  5826
  wcgar_t wc = L'K';
sl@0
  5827
  int n = 3;
sl@0
  5828
 
sl@0
  5829
  /* expected result string */
sl@0
  5830
  wchar_t *exp=L"KKKinoor";
sl@0
  5831
 
sl@0
  5832
  wchar_t *res = NULL;
sl@0
  5833
    
sl@0
  5834
  /* function call to set first n chars in wcs to wc*/
sl@0
  5835
  res = wcsnset(wcs, wc, n);
sl@0
  5836
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
sl@0
  5837
  if( res != NULL && !wcscmp(res,exp))
sl@0
  5838
        return 0;
sl@0
  5839
  else
sl@0
  5840
        return -1;
sl@0
  5841
}
sl@0
  5842
sl@0
  5843
@endcode
sl@0
  5844
@see strset()
sl@0
  5845
@see wcsset()
sl@0
  5846
sl@0
  5847
sl@0
  5848
 
sl@0
  5849
sl@0
  5850
@publishedAll
sl@0
  5851
@released
sl@0
  5852
*/
sl@0
  5853
sl@0
  5854
/** @fn  wcsrev(wchar_t *wcs)
sl@0
  5855
@param wcs
sl@0
  5856
sl@0
  5857
  The wcsrev() function reverses the order of the characters in the wide-character string wcs. The terminating null character remains in place.The arguments and return value of wcsrev are wide-character strings; It returns a pointer to the altered string.
sl@0
  5858
the pointer returned is the same as the pointer passed as the input argument.
sl@0
  5859
sl@0
  5860
@return   The wcsrev() returns a pointer to the reverted string, on success, else it returns NULL pointer.
sl@0
  5861
sl@0
  5862
Examples:
sl@0
  5863
@code
sl@0
  5864
#include <wchar.h>
sl@0
  5865
/* Illustrates how to use wcsrev API */
sl@0
  5866
int example_wcsrev(void)
sl@0
  5867
{ 
sl@0
  5868
  /* input string which needs to be reverted. */
sl@0
  5869
  wchar_t src[9]=L"kohinoor";
sl@0
  5870
 
sl@0
  5871
  /* expected result string */
sl@0
  5872
  wchar_t *exp=L"roonihok";
sl@0
  5873
 
sl@0
  5874
  wchar_t *res = NULL;
sl@0
  5875
    
sl@0
  5876
  /* function call to revert the src */
sl@0
  5877
  res = wcsrev(src);
sl@0
  5878
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
sl@0
  5879
  if( res != NULL && !wcscmp(res,exp))
sl@0
  5880
        return 0;
sl@0
  5881
  else
sl@0
  5882
        return -1;
sl@0
  5883
}
sl@0
  5884
sl@0
  5885
@endcode
sl@0
  5886
@see strrev()
sl@0
  5887
sl@0
  5888
sl@0
  5889
 
sl@0
  5890
sl@0
  5891
@publishedAll
sl@0
  5892
@released
sl@0
  5893
*/
sl@0
  5894
sl@0
  5895
/** @fn  wcsicmp(const wchar_t *wcs1, const wchar_t *wcs2)
sl@0
  5896
@param wcs1
sl@0
  5897
@param wcs2
sl@0
  5898
sl@0
  5899
  The wcsicmp() function
sl@0
  5900
compares the two null-terminated wide-character strings wcs1 and wcs2, by converting them into lower-case.
sl@0
  5901
It returns an integer value indicating the status of
sl@0
  5902
the comparision.
sl@0
  5903
sl@0
  5904
@return   The wcsicmp() returns an integer greater than, equal to, or less than 0,
sl@0
  5905
according as wcs1 is lexicographically greater than, equal to, or less than wcs2 after translation of each corresponding character to lower-case.
sl@0
  5906
The strings themselves are not modified.
sl@0
  5907
sl@0
  5908
Examples:
sl@0
  5909
@code
sl@0
  5910
#include <wchar.h>
sl@0
  5911
/* Illustrates how to use wcsicmp API */
sl@0
  5912
int example_wcsicmp(void)
sl@0
  5913
{ 
sl@0
  5914
  /* input strings which needs to be compared */
sl@0
  5915
  wchar_t *ws1=L"testcasecmp";
sl@0
  5916
  wchar_t *ws2=L"TESTCASECMP";
sl@0
  5917
    
sl@0
  5918
  /* function call to compare the two strings which */
sl@0
  5919
  /* differ in case */
sl@0
  5920
  int retval = wcsicmp(ws1,ws2);
sl@0
  5921
  /* returns 0 if they are equal or > 1 */
sl@0
  5922
  /* if first string is greater than second string else -1 */
sl@0
  5923
  return retval;
sl@0
  5924
}
sl@0
  5925
sl@0
  5926
@endcode
sl@0
  5927
@see strcasecmp()
sl@0
  5928
@see wcscasecmp()
sl@0
  5929
sl@0
  5930
sl@0
  5931
 
sl@0
  5932
sl@0
  5933
@publishedAll
sl@0
  5934
@released
sl@0
  5935
*/
sl@0
  5936
sl@0
  5937
/** @fn  wstrdate(const wchar_t *datestr)
sl@0
  5938
@param datestr
sl@0
  5939
sl@0
  5940
  The wstrdate() function gets the system date and converts it into wide-character 
sl@0
  5941
string. This copies the current system date into the string pointed by datestr in the format dd/mm/yyyy, the datestr buffer must be atleast 11 bytes long. It returns a pointer to 
sl@0
  5942
the datestr string. Because the modification is done in place, the pointer returned 
sl@0
  5943
is the same as the pointer passed as the input argument.
sl@0
  5944
sl@0
  5945
@return   The wstrdate() returns a pointer to the date string on succes, otherwise 
sl@0
  5946
it returns a NULL pointer and sets the errno accordingly.
sl@0
  5947
sl@0
  5948
sl@0
  5949
Examples:
sl@0
  5950
@code
sl@0
  5951
#include <wchar.h>
sl@0
  5952
/* Illustrates how to use wstrdate API */
sl@0
  5953
int example_wstrdate(void)
sl@0
  5954
{ 
sl@0
  5955
  /* input string which is updated with the system date. */
sl@0
  5956
  wchar_t datestr[20];
sl@0
  5957
 
sl@0
  5958
  wchar_t *res = NULL;
sl@0
  5959
    
sl@0
  5960
  /* function call to get the system date in wide-char format */
sl@0
  5961
  res = wstrdate(datestr);
sl@0
  5962
  if( !res && !datestr)
sl@0
  5963
  {
sl@0
  5964
        printf(" res - %s and datestr - %s",res, datestr);
sl@0
  5965
        return 0;
sl@0
  5966
  }
sl@0
  5967
  else
sl@0
  5968
        return -1;
sl@0
  5969
}
sl@0
  5970
sl@0
  5971
@endcode
sl@0
  5972
sl@0
  5973
Output
sl@0
  5974
sl@0
  5975
@code
sl@0
  5976
sl@0
  5977
 res - 21/11/2006 and datestr - 21/11/2006
sl@0
  5978
sl@0
  5979
@endcode
sl@0
  5980
sl@0
  5981
Errors:
sl@0
  5982
sl@0
  5983
The wstrdate function will fail if: 
sl@0
  5984
[EFAULT] The supplied argument datestr is invalid.
sl@0
  5985
sl@0
  5986
@see strdate()
sl@0
  5987
@see strftime()
sl@0
  5988
@see strptime()
sl@0
  5989
@see wstrtime()
sl@0
  5990
sl@0
  5991
sl@0
  5992
 
sl@0
  5993
sl@0
  5994
@publishedAll
sl@0
  5995
@released
sl@0
  5996
*/
sl@0
  5997
sl@0
  5998
/** @fn  wstrtime(const wchar_t *timestr)
sl@0
  5999
@param timestr
sl@0
  6000
sl@0
  6001
  The wstrtime() function gets the system time and converts it into wide-character 
sl@0
  6002
string. This copies the current system time into the string pointed by timestr in the format hh:mm:ss. The timestr buffer must be at least 9 bytes long. The function returns a pointer 
sl@0
  6003
to the timestr string. Because the modification is done in place, the pointer 
sl@0
  6004
returned is the same as the pointer passed as the input argument.
sl@0
  6005
sl@0
  6006
@return   The wstrtime() returns a pointer to the time string on success, otherwise 
sl@0
  6007
it returns a NULL pointer and sets the errno accordingly.
sl@0
  6008
sl@0
  6009
Examples:
sl@0
  6010
@code
sl@0
  6011
#include <wchar.h>
sl@0
  6012
/* Illustrates how to use wstrtime API */
sl@0
  6013
int example_wstrtime(void)
sl@0
  6014
{ 
sl@0
  6015
  /* input string which is updated with the system time. */
sl@0
  6016
  wchar_t timestr[20];
sl@0
  6017
 
sl@0
  6018
  wchar_t *res = NULL;
sl@0
  6019
    
sl@0
  6020
  /* function call to get the system time in wide-char format */
sl@0
  6021
  res = wstrtime(timestr);
sl@0
  6022
  if( !res && !timestr)
sl@0
  6023
  {
sl@0
  6024
        printf(" res - %s and timestr - %s",res, timestr);
sl@0
  6025
        return 0;
sl@0
  6026
  }
sl@0
  6027
  else
sl@0
  6028
        return -1;
sl@0
  6029
}
sl@0
  6030
sl@0
  6031
@endcode
sl@0
  6032
sl@0
  6033
Output
sl@0
  6034
sl@0
  6035
@code
sl@0
  6036
sl@0
  6037
 res - 15:46:36 and timestr - 15:46:36
sl@0
  6038
sl@0
  6039
@endcode
sl@0
  6040
sl@0
  6041
sl@0
  6042
@see strtime()
sl@0
  6043
@see strftime()
sl@0
  6044
@see strptime()
sl@0
  6045
sl@0
  6046
sl@0
  6047
 
sl@0
  6048
sl@0
  6049
@publishedAll
sl@0
  6050
@released
sl@0
  6051
*/
sl@0
  6052
sl@0
  6053
/** @fn  wfdopen(int fd ,const wchar_t *  mode)
sl@0
  6054
@param fd
sl@0
  6055
@param mode
sl@0
  6056
@return   Upon successful completion wfdopen returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
sl@0
  6057
sl@0
  6058
  The wfdopen function
sl@0
  6059
associates a stream with the existing file descriptor, fd. The mode argument is used just as in the function wfopen .
sl@0
  6060
sl@0
  6061
 The mode of the stream must be compatible with the mode of the file descriptor.
sl@0
  6062
In other words the type specified by the stream must be allowed by the file access mode of the open file.
sl@0
  6063
When the stream is closed via fclose, fd is also closed.
sl@0
  6064
sl@0
  6065
sl@0
  6066
Errors:
sl@0
  6067
sl@0
  6068
[EINVAL]  The mode argument to wfdopen, was invalid.  
sl@0
  6069
The function wfdopen may also fail and set errno for any of the errors specified for the routine wopen. 
sl@0
  6070
sl@0
  6071
sl@0
  6072
sl@0
  6073
sl@0
  6074
Limitations:
sl@0
  6075
sl@0
  6076
All the limitations that apply to wfopen apply to wfdopen also.
sl@0
  6077
sl@0
  6078
@see wopen()
sl@0
  6079
@see wfclose()
sl@0
  6080
@see wfopen()
sl@0
  6081
sl@0
  6082
sl@0
  6083
 
sl@0
  6084
sl@0
  6085
@publishedAll
sl@0
  6086
@released
sl@0
  6087
*/
sl@0
  6088
sl@0
  6089
/** @fn  wfreopen(const wchar_t *  file, const wchar_t *  mode,FILE *fp)
sl@0
  6090
@param file
sl@0
  6091
@param mode
sl@0
  6092
@param fp
sl@0
  6093
@return   Upon successful completion wfreopen returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
sl@0
  6094
sl@0
  6095
  The wfreopen function
sl@0
  6096
opens the file whose name is the string pointed to by file and associates the stream pointed to by fp with it.
sl@0
  6097
The original stream (if it exists) is closed.
sl@0
  6098
The mode argument is used just as in the wfopen function.
sl@0
  6099
sl@0
  6100
 If the file argument is NULL, wfreopen attempts to re-open the file associated with fp with a new mode.
sl@0
  6101
The new mode must be compatible with the mode that the stream was originally
sl@0
  6102
opened with: Streams originally opened with mode "r"
sl@0
  6103
can only be reopened with that same mode. Streams originally opened with mode "a"
sl@0
  6104
can be reopened with the same mode, or mode "w." Streams originally opened with mode "w"
sl@0
  6105
can be reopened with the same mode, or mode "a." Streams originally opened with mode "r+," "w+,"
sl@0
  6106
or "a+"
sl@0
  6107
can be reopened with any mode.
sl@0
  6108
sl@0
  6109
 The primary use of the wfreopen function
sl@0
  6110
is to change the file associated with a
sl@0
  6111
standard text stream (stderr, stdin, or stdout).
sl@0
  6112
sl@0
  6113
sl@0
  6114
sl@0
  6115
sl@0
  6116
sl@0
  6117
Examples:
sl@0
  6118
@code
sl@0
  6119
/* wfreopen example: redirecting stdout */
sl@0
  6120
#include <stdio.h>
sl@0
  6121
#include <wchar.h>
sl@0
  6122
int main ()
sl@0
  6123
{
sl@0
  6124
  wfreopen (L"c:\myfile.txt",L"w",stdout);
sl@0
  6125
  printf ("This sentence is redirected to a file.");
sl@0
  6126
  fclose (stdout);
sl@0
  6127
  return 0;
sl@0
  6128
}
sl@0
  6129
sl@0
  6130
@endcode
sl@0
  6131
 Output:
sl@0
  6132
@code
sl@0
  6133
Contents of myfile.txt:This sentence is redirected to a file.
sl@0
  6134
The output here is redirected from stdout to file myfile.txt
sl@0
  6135
sl@0
  6136
@endcode
sl@0
  6137
sl@0
  6138
Limitations:
sl@0
  6139
sl@0
  6140
All the limitations that apply to wfopen apply to wfreopen also.
sl@0
  6141
sl@0
  6142
@see wopen()
sl@0
  6143
@see wfclose()
sl@0
  6144
@see wfopen()
sl@0
  6145
sl@0
  6146
sl@0
  6147
 
sl@0
  6148
sl@0
  6149
@publishedAll
sl@0
  6150
@released
sl@0
  6151
*/
sl@0
  6152
sl@0
  6153
/** @fn  wfreopen64(const wchar_t *  file, const wchar_t *  mode,FILE *fp)
sl@0
  6154
@param file
sl@0
  6155
@param mode
sl@0
  6156
@param fp
sl@0
  6157
@return   Upon successful completion wfreopen64 returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
sl@0
  6158
sl@0
  6159
The wfreopen64() function is a 64-bit version of wfreopen64.
sl@0
  6160
sl@0
  6161
@publishedAll
sl@0
  6162
@released
sl@0
  6163
*/
sl@0
  6164
sl@0
  6165
sl@0
  6166
/** @fn  getws(wchar_t *  str)
sl@0
  6167
@param str
sl@0
  6168
@return   Upon successful completion, getws returns str. The getws function does not distinguish between end-of-file and error: Callers 
sl@0
  6169
must use feof and ferror to determine which occurred.
sl@0
  6170
sl@0
  6171
 
sl@0
  6172
sl@0
  6173
 The getws function
sl@0
  6174
is equivalent to fgetws with an infinite size and a stream of stdin, except that the wide character newline(if any) is not stored in the string.
sl@0
  6175
It is the caller's responsibility to ensure that the input line,
sl@0
  6176
if any, is sufficiently short to fit in the string.
sl@0
  6177
sl@0
  6178
sl@0
  6179
sl@0
  6180
Examples:
sl@0
  6181
@code
sl@0
  6182
#include <stdio.h>
sl@0
  6183
#include <wchar.h>
sl@0
  6184
/* Illustrates how to use getws API */
sl@0
  6185
int example_getws()
sl@0
  6186
        {
sl@0
  6187
        FILE* stdop = freopen("c:\stdop","w+",stdout);
sl@0
  6188
        FILE* stdip = freopen("c:\stdip","w+",stdin);
sl@0
  6189
        FILE* stder = freopen("c:\stder","w+",stderr);
sl@0
  6190
        wchar_t* buf = (wchar_t*)malloc(sizeof(wchar_t)*50);
sl@0
  6191
        wchar_t s[100];
sl@0
  6192
        int ret = 0;
sl@0
  6193
        size_t size = fwrite("abdcef
sl@0
  6194
", 1, 6, stdip);          //write to stdin
sl@0
  6195
        fclose(stdip);
sl@0
  6196
        stdip = freopen("c:\stdip","r", stdin);
sl@0
  6197
        getws(s);               // read a line (from stdin)
sl@0
  6198
        putws(s);               //write to stdout
sl@0
  6199
        fclose(stdop);
sl@0
  6200
        stdop = freopen("c:\stdop","r", stdout);
sl@0
  6201
        fgetws(buf,7,stdop);            //read from stdout
sl@0
  6202
        if(wcsncmp(s, buf,6))
sl@0
  6203
                {
sl@0
  6204
                ret = -1;
sl@0
  6205
                }
sl@0
  6206
        fclose(stdin);
sl@0
  6207
        fclose(stder);
sl@0
  6208
        fclose(stdop);
sl@0
  6209
        remove("c:\stdop");
sl@0
  6210
        remove("c:\stdip");
sl@0
  6211
        remove("c:\stder");
sl@0
  6212
        return ret;
sl@0
  6213
        }
sl@0
  6214
sl@0
  6215
@endcode
sl@0
  6216
 Output
sl@0
  6217
@code
sl@0
  6218
abcdef
sl@0
  6219
abcdef
sl@0
  6220
sl@0
  6221
@endcode
sl@0
  6222
sl@0
  6223
Security considerations:
sl@0
  6224
sl@0
  6225
 The getws function cannot be used securely. Because of its lack of bounds 
sl@0
  6226
checking, and the inability for the calling program to determine reliably the 
sl@0
  6227
length of the next incoming line, the use of this function enables malicious users 
sl@0
  6228
to arbitrarily change a running program's functionality through a buffer 
sl@0
  6229
overflow attack. It is strongly suggested that the fgetws function be used in all cases.
sl@0
  6230
sl@0
  6231
@see feof()
sl@0
  6232
@see ferror()
sl@0
  6233
@see fgets()
sl@0
  6234
@see fgetws()
sl@0
  6235
@see gets()
sl@0
  6236
sl@0
  6237
sl@0
  6238
 
sl@0
  6239
sl@0
  6240
@publishedAll
sl@0
  6241
@released
sl@0
  6242
*/
sl@0
  6243
sl@0
  6244
/** @fn  wremove(const wchar_t *file)
sl@0
  6245
@param file
sl@0
  6246
@return   Upon successful completion, wremove returns 0. Otherwise, it returns -1 is and sets the global 
sl@0
  6247
  variable errno to indicate the error.
sl@0
  6248
sl@0
  6249
  The wremove function removes the file or directory specified by the wide character name referred by file.
sl@0
  6250
sl@0
  6251
 If file specifies a directory, wremove (file); is the equivalent of wrmdir (file); Otherwise, it is the equivalent of wunlink (file);
sl@0
  6252
sl@0
  6253
Examples:
sl@0
  6254
@code
sl@0
  6255
/* this program shows deleting a file using wremove */
sl@0
  6256
#include <stdio.h>
sl@0
  6257
int main()
sl@0
  6258
{
sl@0
  6259
        wchar_t* name = L"C:\input.txt";
sl@0
  6260
        FILE *fp = wfopen(name, L"w+");
sl@0
  6261
        if (fp == NULL)
sl@0
  6262
                {
sl@0
  6263
                printf ("fopen failed
sl@0
  6264
");
sl@0
  6265
                return -1;
sl@0
  6266
                }
sl@0
  6267
        fprintf(fp,"hello world");
sl@0
  6268
        fclose(fp);
sl@0
  6269
        
sl@0
  6270
        wremove(name);
sl@0
  6271
        fp=wfopen(name,L"r");
sl@0
  6272
        if (fp == NULL)
sl@0
  6273
                {
sl@0
  6274
                printf ("file has been deleted already
sl@0
  6275
");
sl@0
  6276
                }
sl@0
  6277
        else
sl@0
  6278
                {
sl@0
  6279
                printf("wremove failed
sl@0
  6280
");
sl@0
  6281
                return -1;
sl@0
  6282
                }
sl@0
  6283
        return 0;
sl@0
  6284
}
sl@0
  6285
sl@0
  6286
@endcode
sl@0
  6287
 Output
sl@0
  6288
@code
sl@0
  6289
file has been deleted already
sl@0
  6290
sl@0
  6291
@endcode
sl@0
  6292
@see wrmdir()
sl@0
  6293
@see wunlink()
sl@0
  6294
sl@0
  6295
sl@0
  6296
 
sl@0
  6297
sl@0
  6298
@publishedAll
sl@0
  6299
@released
sl@0
  6300
*/
sl@0
  6301
sl@0
  6302
/** @fn  putws(wchar_t *  str)
sl@0
  6303
@param str
sl@0
  6304
@return   The putws function
sl@0
  6305
returns 0 on success and -1 on error.
sl@0
  6306
sl@0
  6307
  The putws function writes the wide character string pointed to by str to the stdout stream.
sl@0
  6308
sl@0
  6309
sl@0
  6310
sl@0
  6311
Examples:
sl@0
  6312
@code
sl@0
  6313
#include <stdio.h>
sl@0
  6314
#include <wchar.h>
sl@0
  6315
/* Illustrates how to use putws API */
sl@0
  6316
int example_putws()
sl@0
  6317
{
sl@0
  6318
        wchar_t buf[12];
sl@0
  6319
        FILE* op;
sl@0
  6320
        FILE* stdop = freopen("c:\stdop","w+",stdout);
sl@0
  6321
                
sl@0
  6322
        putws(L"Hello World");          //write to stdout
sl@0
  6323
        
sl@0
  6324
        fclose(stdop);
sl@0
  6325
                
sl@0
  6326
        op = freopen("c:\stdop","r",stdout);
sl@0
  6327
                
sl@0
  6328
        fgetws(buf, 12, op);            //read from stdout
sl@0
  6329
                
sl@0
  6330
        fclose(stdop);
sl@0
  6331
                
sl@0
  6332
        remove("c:\stdop");
sl@0
  6333
        
sl@0
  6334
        if(!(wcsncmp(L"Hello World", buf, 11)))
sl@0
  6335
                {                       
sl@0
  6336
                return 0;
sl@0
  6337
                }       
sl@0
  6338
        return -1;
sl@0
  6339
}
sl@0
  6340
}
sl@0
  6341
sl@0
  6342
@endcode
sl@0
  6343
@see ferror()
sl@0
  6344
@see fputws()
sl@0
  6345
@see fputs()
sl@0
  6346
@see putwc()
sl@0
  6347
sl@0
  6348
sl@0
  6349
 
sl@0
  6350
sl@0
  6351
@publishedAll
sl@0
  6352
@released
sl@0
  6353
*/
sl@0
  6354
sl@0
  6355
/** @fn  wtelldir(const WDIR *wdp)
sl@0
  6356
@param wdp
sl@0
  6357
sl@0
  6358
Note: This description also covers the following functions -
sl@0
  6359
 wseekdir() 
sl@0
  6360
sl@0
  6361
@return   wtelldir function returns current location associated with the named directory stream on success or -1 on failure.
sl@0
  6362
sl@0
  6363
  The wtelldir function
sl@0
  6364
returns the current location associated with the named directory stream .
sl@0
  6365
Values returned by wtelldir are good only for the lifetime of the DIR pointer, dirp ,
sl@0
  6366
from which they are derived.
sl@0
  6367
If the directory is closed and then
sl@0
  6368
reopened, prior values returned by wtelldir will no longer be valid.
sl@0
  6369
sl@0
  6370
 The wseekdir function
sl@0
  6371
sets the position of the next wreaddir operation on the directory stream .
sl@0
  6372
The new position reverts to the one associated with the directory stream when the wtelldir operation was performed.
sl@0
  6373
sl@0
  6374
sl@0
  6375
sl@0
  6376
Examples:
sl@0
  6377
@code
sl@0
  6378
#include <dirent.h>
sl@0
  6379
#include<wchar.h>
sl@0
  6380
#include<stdio.h>
sl@0
  6381
#include<unistd.h>
sl@0
  6382
#include<sys/types.h>
sl@0
  6383
void  wTest()
sl@0
  6384
    {
sl@0
  6385
      //declare the variables for dir pointer and dir position.
sl@0
  6386
      wchar_t *dirName  =L"c:	est_wseekdir";
sl@0
  6387
      off_t dirpos;
sl@0
  6388
        // Open the directory
sl@0
  6389
        WDIR *dirp = wopendir (dirName);
sl@0
  6390
        
sl@0
  6391
        if(dirp != NULL)
sl@0
  6392
        {
sl@0
  6393
                //read the directory.
sl@0
  6394
                wreaddir(dirp);
sl@0
  6395
                wreaddir(dirp);
sl@0
  6396
                //get the dirp pointer position by calling telldir API.
sl@0
  6397
                dirpos = wtelldir(dirp);
sl@0
  6398
                //print the position of the dirp pointer.
sl@0
  6399
                printf("dirp is pointing at position %ld.",dirpos);
sl@0
  6400
                
sl@0
  6401
                wseekdir(dirp , 0) ;
sl@0
  6402
                wreaddir(dirp);
sl@0
  6403
                dirpos = wtelldir(dirp);
sl@0
  6404
                //print the position of the dirp pointer.
sl@0
  6405
                printf("dirp is pointing at position %ld.",dirpos);
sl@0
  6406
        }
sl@0
  6407
    }
sl@0
  6408
sl@0
  6409
@endcode
sl@0
  6410
sl@0
  6411
 Output
sl@0
  6412
sl@0
  6413
@code
sl@0
  6414
Dirp is pointing at position 2.
sl@0
  6415
Dirp is pointing at position 1.
sl@0
  6416
sl@0
  6417
@endcode
sl@0
  6418
@see wclosedir()
sl@0
  6419
@see wopendir()
sl@0
  6420
@see wreaddir()
sl@0
  6421
sl@0
  6422
sl@0
  6423
 
sl@0
  6424
sl@0
  6425
@publishedAll
sl@0
  6426
@released
sl@0
  6427
*/
sl@0
  6428
sl@0
  6429
sl@0
  6430
/** @fn  wopendir(const wchar_t *_wpath)
sl@0
  6431
@param _wpath
sl@0
  6432
@return   The wopendir function returns a pointer to the directory stream or NULL if an error occurred.
sl@0
  6433
sl@0
  6434
  The wopendir function
sl@0
  6435
opens the directory given by the wide-character name _wpath, associates a directory stream with it and positions it at the first entry
sl@0
  6436
and
sl@0
  6437
returns a pointer to be used to identify the directory stream in subsequent operations.
sl@0
  6438
The pointer NULL is returned if _wpath cannot be accessed, or if it cannot malloc enough memory to hold the whole thing.
sl@0
  6439
sl@0
  6440
sl@0
  6441
sl@0
  6442
Examples:
sl@0
  6443
@code
sl@0
  6444
/* Detailed description: This test code demonstrates usage of wopendir system call, open directory wide name "test".
sl@0
  6445
 * Preconditions: Expects "test" directory to be present in the current working directory.
sl@0
  6446
 */
sl@0
  6447
 #include <wchar.h>
sl@0
  6448
 #include <stdio.h>
sl@0
  6449
 #include <dirent.h>
sl@0
  6450
int main()
sl@0
  6451
{
sl@0
  6452
  WDIR *WDirHandle;
sl@0
  6453
  if(!(WDirHandle = wopendir(L"test") ) ) 
sl@0
  6454
  {
sl@0
  6455
     printf("Failed to open directory test
sl@0
  6456
");
sl@0
  6457
     return -1;
sl@0
  6458
  }
sl@0
  6459
  printf("Directory test opened 
sl@0
  6460
");
sl@0
  6461
  wclosedir(WDirHandle);
sl@0
  6462
  return 0;
sl@0
  6463
}
sl@0
  6464
sl@0
  6465
@endcode
sl@0
  6466
 Output
sl@0
  6467
@code
sl@0
  6468
Directory test opened
sl@0
  6469
sl@0
  6470
@endcode
sl@0
  6471
@see opendir()
sl@0
  6472
@see close()
sl@0
  6473
@see lseek()
sl@0
  6474
@see open()
sl@0
  6475
@see read()
sl@0
  6476
sl@0
  6477
sl@0
  6478
 
sl@0
  6479
sl@0
  6480
@publishedAll
sl@0
  6481
@externallyDefinedApi
sl@0
  6482
*/
sl@0
  6483
sl@0
  6484
sl@0
  6485
/** @fn  wcslcat(wchar_t *s1, const wchar_t *s2, size_t n)
sl@0
  6486
@param s1
sl@0
  6487
@param s2
sl@0
  6488
@param n
sl@0
  6489
sl@0
  6490
Refer to wmemchr() for the documentation
sl@0
  6491
sl@0
  6492
@see memchr()
sl@0
  6493
@see memcmp()
sl@0
  6494
@see memcpy()
sl@0
  6495
@see memmove()
sl@0
  6496
@see memset()
sl@0
  6497
@see strcat()
sl@0
  6498
@see strchr()
sl@0
  6499
@see strcmp()
sl@0
  6500
@see strcpy()
sl@0
  6501
@see strcspn()
sl@0
  6502
@see strlen()
sl@0
  6503
@see strncat()
sl@0
  6504
@see strncmp()
sl@0
  6505
@see strncpy()
sl@0
  6506
@see strpbrk()
sl@0
  6507
@see strrchr()
sl@0
  6508
@see strspn()
sl@0
  6509
@see strstr()
sl@0
  6510
sl@0
  6511
sl@0
  6512
 
sl@0
  6513
sl@0
  6514
@publishedAll
sl@0
  6515
@released
sl@0
  6516
*/
sl@0
  6517
sl@0
  6518
/** @fn  wcslcpy(wchar_t *s1, const wchar_t *s2, size_t n)
sl@0
  6519
@param s1
sl@0
  6520
@param s2
sl@0
  6521
@param n
sl@0
  6522
sl@0
  6523
Refer to wmemchr() for the documentation
sl@0
  6524
sl@0
  6525
@see memchr()
sl@0
  6526
@see memcmp()
sl@0
  6527
@see memcpy()
sl@0
  6528
@see memmove()
sl@0
  6529
@see memset()
sl@0
  6530
@see strcat()
sl@0
  6531
@see strchr()
sl@0
  6532
@see strcmp()
sl@0
  6533
@see strcpy()
sl@0
  6534
@see strcspn()
sl@0
  6535
@see strlen()
sl@0
  6536
@see strncat()
sl@0
  6537
@see strncmp()
sl@0
  6538
@see strncpy()
sl@0
  6539
@see strpbrk()
sl@0
  6540
@see strrchr()
sl@0
  6541
@see strspn()
sl@0
  6542
@see strstr()
sl@0
  6543
sl@0
  6544
sl@0
  6545
 
sl@0
  6546
sl@0
  6547
@publishedAll
sl@0
  6548
@released
sl@0
  6549
*/
sl@0
  6550
sl@0
  6551
/** @fn  wasctime(const struct tm *tm)
sl@0
  6552
@param tm
sl@0
  6553
sl@0
  6554
Refer to wctime() for the documentation
sl@0
  6555
sl@0
  6556
@see asctime()
sl@0
  6557
@see ctime()
sl@0
  6558
sl@0
  6559
sl@0
  6560
 
sl@0
  6561
sl@0
  6562
@publishedAll
sl@0
  6563
@released
sl@0
  6564
*/
sl@0
  6565
sl@0
  6566
/** @fn  wctime(const time_t *clock)
sl@0
  6567
@param clock
sl@0
  6568
sl@0
  6569
Note: This description also covers the following functions -
sl@0
  6570
 wasctime() 
sl@0
  6571
sl@0
  6572
@return   The functions wasctime and wctime return a pointer to the resulting wide-character string.
sl@0
  6573
sl@0
  6574
  The function wctime takes a time value representing the time in seconds since the 
sl@0
  6575
Epoch (00:00:00 UTC, January 1, 1970) as an argument. See time
sl@0
  6576
sl@0
  6577
 The function wctime adjusts the time value for the current time zone in the same 
sl@0
  6578
  manner as localtime and returns a pointer to a 26-wide character string of the 
sl@0
  6579
  form: Thu Nov 24 18:22:48 1986
sl@0
  6580
\\0 All the fields have constant width.
sl@0
  6581
sl@0
  6582
 The function wasctime converts the broken down time in the structure tm , pointed at by *tm , to the form shown in the example above.
sl@0
  6583
sl@0
  6584
 @code
sl@0
  6585
 External declarations as well as the tm structure definition are in the #include <time.h> include file. The tm structure includes 
sl@0
  6586
  at least the following fields: 
sl@0
  6587
sl@0
  6588
int tm_sec;/* seconds (0 - 60) */
sl@0
  6589
int tm_min;/* minutes (0 - 59) */
sl@0
  6590
int tm_hour;/* hours (0 - 23) */
sl@0
  6591
int tm_mday;/* day of month (1 - 31) */
sl@0
  6592
int tm_mon;/* month of year (0 - 11) */
sl@0
  6593
int tm_year;/* year - 1900 */
sl@0
  6594
int tm_wday;/* day of week (Sunday = 0) */
sl@0
  6595
int tm_yday;/* day of year (0 - 365) */
sl@0
  6596
int tm_isdst;/* is summer time in effect? */
sl@0
  6597
char *tm_zone;/* abbreviation of timezone name */
sl@0
  6598
long tm_gmtoff;/* offset from UTC in seconds */
sl@0
  6599
@endcode
sl@0
  6600
sl@0
  6601
 The
sl@0
  6602
field tm_isdst is non-zero if summer time is in effect.
sl@0
  6603
sl@0
  6604
 The field tm_gmtoff is the offset (in seconds) of the time represented from UTC, with positive
sl@0
  6605
values indicating east of the Prime Meridian.
sl@0
  6606
sl@0
  6607
sl@0
  6608
sl@0
  6609
Examples:
sl@0
  6610
@code
sl@0
  6611
//Example usage of wasctime and wctime:
sl@0
  6612
#include <time.h>
sl@0
  6613
#include <stdio.h>
sl@0
  6614
int main(){
sl@0
  6615
        time_t t;
sl@0
  6616
        struct tm *timeptr;
sl@0
  6617
        wchar_t* wasc_time;
sl@0
  6618
        t = time (NULL); //Get current time in seconds from Epoc
sl@0
  6619
        //Fill tm struct w.r.t localtime using localtime
sl@0
  6620
        timeptr = localtime (&t;);
sl@0
  6621
        //Use this to convert it to a string indicating time w.r.t localtime
sl@0
  6622
        wasc_time = wasctime (timeptr);
sl@0
  6623
        wprintf (L"Time from wasctime w.r.t localtime : %s", wasc_time);
sl@0
  6624
                wprintf(L"Time from wctime w.r.t localtime : %s0, wctime(&t;) );
sl@0
  6625
         return 0;
sl@0
  6626
}
sl@0
  6627
sl@0
  6628
@endcode
sl@0
  6629
 Output
sl@0
  6630
@code
sl@0
  6631
Time from wasctime w.r.t localtime : Thu Jun 22 10:42:27 2006
sl@0
  6632
Time from wctime w.r.t localtime : Thu Jun 22 10:42:27 2006
sl@0
  6633
sl@0
  6634
@endcode
sl@0
  6635
@code
sl@0
  6636
sl@0
  6637
@endcode
sl@0
  6638
@see asctime()
sl@0
  6639
@see ctime()
sl@0
  6640
sl@0
  6641
sl@0
  6642
Bugs:
sl@0
  6643
sl@0
  6644
 These functions leave their result in an internal static object and return
sl@0
  6645
a pointer to that object.
sl@0
  6646
Subsequent calls to these
sl@0
  6647
functions will modify the same object. The C Standard provides no mechanism for a program to modify its current local 
sl@0
  6648
  timezone setting and the POSIX -standard method is not reentrant. (However, thread-safe implementations 
sl@0
  6649
  are provided in the POSIX threaded environment.) The tm_zone field of a returned tm structure points to a static array of characters which will also be overwritten 
sl@0
  6650
  by any subsequent calls (as well as by subsequent call to tzset ) 
sl@0
  6651
sl@0
  6652
 
sl@0
  6653
sl@0
  6654
@publishedAll
sl@0
  6655
@released
sl@0
  6656
*/
sl@0
  6657
sl@0
  6658
/** @fn  wsetlocale(int category, const wchar_t *locale)
sl@0
  6659
@param category
sl@0
  6660
@param locale
sl@0
  6661
@return   Upon successful completion, wsetlocale returns the  wide char string associated with the specified category for the requested locale. The wsetlocale function returns NULL and fails to change the locale
sl@0
  6662
if the given combination of category and locale make no sense.
sl@0
  6663
sl@0
  6664
sl@0
  6665
The wsetlocale function sets the C library's notion
sl@0
  6666
of natural language formatting style
sl@0
  6667
for particular sets of routines.
sl@0
  6668
Each such style is called a 'locale'
sl@0
  6669
and is invoked using an appropriate name passed as a wide char string.
sl@0
  6670
sl@0
  6671
 The wsetlocale function can recognise several categories of routines.
sl@0
  6672
The categories and the sets of routines recognised by wsetlocale are listed below:
sl@0
  6673
sl@0
  6674
 @code
sl@0
  6675
 LC_ALL Set the entire locale generically.
sl@0
  6676
 LC_COLLATE Set a locale for string collation routines. Currently locale setting does not have effect on
sl@0
  6677
 this category.
sl@0
  6678
 LC_CTYPE This controls recognition of upper and lower case,
sl@0
  6679
 alphabetic or non-alphabetic characters,
sl@0
  6680
 and so on. Currently locale setting does not have effect on this category.
sl@0
  6681
 LC_MESSAGES
sl@0
  6682
  Set a locale for message catalogs. Currently this category is not supported.
sl@0
  6683
 LC_MONETARY
sl@0
  6684
  Set a locale for formatting monetary values;
sl@0
  6685
 this affects the localeconv function.
sl@0
  6686
 LC_NUMERIC Set a locale for formatting numbers.
sl@0
  6687
 This controls the formatting of decimal points
sl@0
  6688
 in input and output of floating point numbers
sl@0
  6689
 in functions such as printf and scanf, as well as values returned by localeconv.
sl@0
  6690
 LC_TIME Set a locale for formatting dates and times using the strftime function.
sl@0
  6691
sl@0
  6692
@endcode
sl@0
  6693
sl@0
  6694
 Only three locales are defined by default,
sl@0
  6695
the empty string which denotes the native environment, the C 
sl@0
  6696
and the POSIX 
sl@0
  6697
locales, which denote the C language environment.
sl@0
  6698
A locale argument of NULL causes wsetlocale to return the current locale.
sl@0
  6699
By default, C programs start in the C 
sl@0
  6700
locale.
sl@0
  6701
The only functions in the library that set the locale are wsetlocale and setlocale; the locale is never changed as a side effect of some other routine.
sl@0
  6702
sl@0
  6703
Examples:
sl@0
  6704
@code
sl@0
  6705
#include<stdio.h>
sl@0
  6706
#include<wchar.h>
sl@0
  6707
int main()
sl@0
  6708
{
sl@0
  6709
        //Set the locale to UK English
sl@0
  6710
        wchar_t* locale = wsetlocale(LC_ALL,L"en_GB.ISO-8859-1");
sl@0
  6711
        //Check whether locale setting is succesful or not
sl@0
  6712
        if(NULL != locale)
sl@0
  6713
        {
sl@0
  6714
                wprintf(L"Locale setting is successful
sl@0
  6715
");
sl@0
  6716
                wprintf(L"Locale is set to %s
sl@0
  6717
", locale);
sl@0
  6718
        }
sl@0
  6719
        else
sl@0
  6720
        {
sl@0
  6721
                wprintf(L"Locale setting failed
sl@0
  6722
");
sl@0
  6723
        }
sl@0
  6724
        return 0;
sl@0
  6725
}
sl@0
  6726
sl@0
  6727
@endcode
sl@0
  6728
 Output
sl@0
  6729
@code
sl@0
  6730
Locale setting is successful
sl@0
  6731
Locale is set to en_GB.ISO-8859-1
sl@0
  6732
sl@0
  6733
@endcode
sl@0
  6734
@see setlocale()
sl@0
  6735
@see localeconv()
sl@0
  6736
@see nl_langinfo()
sl@0
  6737
sl@0
  6738
sl@0
  6739
 
sl@0
  6740
sl@0
  6741
@publishedAll
sl@0
  6742
@released
sl@0
  6743
*/
sl@0
  6744
sl@0
  6745
/** @fn  wperror(const wchar_t *s)
sl@0
  6746
@param s
sl@0
  6747
sl@0
  6748
Note: This description also covers the following functions -
sl@0
  6749
 wcserror() 
sl@0
  6750
sl@0
  6751
@return   The function wcserror returns the appropriate error description wide char string, or an unknown error message if the error code is unknown. The value of errno is not changed for a successful call, and is set to a nonzero value upon error.
sl@0
  6752
sl@0
  6753
  The functions wcserror and wperror look up the error message string corresponding to an
sl@0
  6754
error number.
sl@0
  6755
sl@0
  6756
 The function wcserror function accepts an error number argument errnum (error number) and returns a pointer to the corresponding
sl@0
  6757
message string.
sl@0
  6758
sl@0
  6759
 The function wperror finds the error message corresponding to the current
sl@0
  6760
value of the global variable errno and writes it, followed by a newline, to the
sl@0
  6761
standard error file descriptor.
sl@0
  6762
If the argument s is non- NULL and does not point to the null character,
sl@0
  6763
this wide char string is prepended to the message
sl@0
  6764
string and separated from it by
sl@0
  6765
a colon and space (": ");
sl@0
  6766
otherwise, only the error message string is printed.
sl@0
  6767
sl@0
  6768
 If the error number is not recognized, these functions return an error message
sl@0
  6769
string containing "Unknown error: "
sl@0
  6770
followed by the error number in decimal.
sl@0
  6771
The wcserror function returns EINVAL as a warning.
sl@0
  6772
Error numbers recognized by this implementation fall in
sl@0
  6773
the range 0 \<errnum \<sys_nerr .
sl@0
  6774
sl@0
  6775
 If insufficient storage is provided in strerrbuf (as specified in buflen )
sl@0
  6776
to contain the error string, wcserror returns ERANGE and strerrbuf will contain an error message that has been truncated and NUL terminated to fit the length specified by buflen .
sl@0
  6777
sl@0
  6778
sl@0
  6779
sl@0
  6780
Examples:
sl@0
  6781
@code
sl@0
  6782
#include <string.h>
sl@0
  6783
#include <stdio.h>
sl@0
  6784
#include <errno.h>
sl@0
  6785
#include <wchar.h>
sl@0
  6786
int main()
sl@0
  6787
{
sl@0
  6788
    wchar_t *ptr = wcserror(ERANGE);
sl@0
  6789
    wprintf(L"wcserror(ERANGE) = %s
sl@0
  6790
",ptr);
sl@0
  6791
    return 0;
sl@0
  6792
}
sl@0
  6793
sl@0
  6794
@endcode
sl@0
  6795
 Output
sl@0
  6796
@code
sl@0
  6797
wcserror(ERANGE) = Numerical result out of range
sl@0
  6798
sl@0
  6799
@endcode
sl@0
  6800
@see perror()
sl@0
  6801
@see strerror()
sl@0
  6802
sl@0
  6803
sl@0
  6804
Bugs:
sl@0
  6805
sl@0
  6806
 For unknown error numbers, the function wcserror will return its result in a static buffer which
sl@0
  6807
may be overwritten by subsequent calls. The return type for wcserror is missing a type-qualifier. The type-qualifier must be const wchar_t * . 
sl@0
  6808
sl@0
  6809
 
sl@0
  6810
sl@0
  6811
@publishedAll
sl@0
  6812
@released
sl@0
  6813
*/
sl@0
  6814
sl@0
  6815
/** @fn  wcserror(int num)
sl@0
  6816
@param num
sl@0
  6817
sl@0
  6818
Refer to wperror() for the documentation
sl@0
  6819
sl@0
  6820
@see perror()
sl@0
  6821
@see strerror()
sl@0
  6822
sl@0
  6823
sl@0
  6824
 
sl@0
  6825
sl@0
  6826
@publishedAll
sl@0
  6827
@released
sl@0
  6828
*/
sl@0
  6829
sl@0
  6830
/** @fn  wfindnext(intptr_t handle, struct _wfinddata_t * fileinfo)
sl@0
  6831
@param handle
sl@0
  6832
@param fileinfo
sl@0
  6833
sl@0
  6834
Refer to wfindfirst() for the documentation
sl@0
  6835
sl@0
  6836
sl@0
  6837
 
sl@0
  6838
sl@0
  6839
@publishedAll
sl@0
  6840
@released
sl@0
  6841
*/
sl@0
  6842
sl@0
  6843
/** @fn  wfindfirst(const wchar_t*  filespec, struct _wfinddata_t* fileinfo)
sl@0
  6844
@param filespec
sl@0
  6845
@param fileinfo
sl@0
  6846
sl@0
  6847
Note: This description also covers the following functions -
sl@0
  6848
 wfindnext()  findclose() 
sl@0
  6849
sl@0
  6850
@return   If successful, wfindfirst return a unique search handle identifying the file or group 
sl@0
  6851
  of files matching the filespec specification. The handle can be used in a subsequent 
sl@0
  6852
  call to wfindnext or to findclose. Otherwise, wfindfirst returns -1 and sets 
sl@0
  6853
  errno accordingly. If successful, wfindnext returns 0. Otherwise, returns -1 and sets errno to a value indicating the nature of the failure. If successful, findclose returns 0.  Otherwise, it returns -1 and sets errno to ENOENT
sl@0
  6854
sl@0
  6855
Errors:
sl@0
  6856
sl@0
  6857
[EINVAL]  Invalid parameter: filespec or fileinfo was NULL. Or, the operating system returned an unexpected error. 
sl@0
  6858
[ENOENT]  File specification that could not be matched. 
sl@0
  6859
sl@0
  6860
  The wfindfirst function provides information about the first instance of a file name that matches the file specified in the filespec argument. Any wildcard combination supported by the host operating system can be used in filespec. File information is returned in a _wfinddata_t structure, defined in wchar.h. The  _wfinddata_t structure includes the following elements.
sl@0
  6861
sl@0
  6862
@code
sl@0
  6863
 unsigned attrib File attribute
sl@0
  6864
@endcode
sl@0
  6865
sl@0
  6866
 time_t time_create  Time of file creation (-1L for Symbian OS)
sl@0
  6867
sl@0
  6868
 time_t time_access  Time of the last file access (-1L for Symbian OS)
sl@0
  6869
sl@0
  6870
 time_t time_write Time of the last write to file
sl@0
  6871
sl@0
  6872
 size_t size Length of the file in bytes
sl@0
  6873
sl@0
  6874
 wchar_t name[260] Null-terminated name of matched file/directory, without the path
sl@0
  6875
sl@0
  6876
sl@0
  6877
sl@0
  6878
 This attribute is returned in the attrib field of the _wfinddata_t structure and can have the following values (defined in wchar.h). 
sl@0
  6879
sl@0
  6880
 @code
sl@0
  6881
 _A_ARCH Archive.
sl@0
  6882
 _A_HIDDEN
sl@0
  6883
  Hidden file.
sl@0
  6884
 _A_NORMAL
sl@0
  6885
  Normal.
sl@0
  6886
 _A_RDONLY
sl@0
  6887
  Read-only.
sl@0
  6888
 _A_SYSTEM
sl@0
  6889
  System file.
sl@0
  6890
sl@0
  6891
@endcode
sl@0
  6892
sl@0
  6893
 The wfindnext finds the next name, if any, that matches the filespec argument in a previous call to wfindfirst and then alters the fileinfo structure contents accordingly.
sl@0
  6894
sl@0
  6895
 The findclose closes the specified search handle and releases the associated resources.
sl@0
  6896
sl@0
  6897
sl@0
  6898
sl@0
  6899
sl@0
  6900
sl@0
  6901
Examples:
sl@0
  6902
@code
sl@0
  6903
#include <wchar.h>
sl@0
  6904
int main( void )
sl@0
  6905
{
sl@0
  6906
   struct _wfinddata_t c_file;
sl@0
  6907
   intptr_t hFile;
sl@0
  6908
   // Find  .txt file in current directory
sl@0
  6909
   if( (hFile = wfindfirst( L"*.txt", &c;_file )) == -1L )
sl@0
  6910
      printf( "No *.txt files in current directory" );
sl@0
  6911
   else
sl@0
  6912
   {
sl@0
  6913
        int i = 1;
sl@0
  6914
      do {
sl@0
  6915
             wprintf( L" File %d = %s ",i,c_file.name);
sl@0
  6916
             i++;
sl@0
  6917
                     } while( wfindnext( hFile, &c;_file ) == 0 );
sl@0
  6918
      findclose( hFile );
sl@0
  6919
   }
sl@0
  6920
   return 0 ;
sl@0
  6921
}  
sl@0
  6922
sl@0
  6923
@endcode
sl@0
  6924
 Output
sl@0
  6925
@code
sl@0
  6926
File 1 = test1.txt
sl@0
  6927
File 2 = test2.txt
sl@0
  6928
sl@0
  6929
@endcode
sl@0
  6930
sl@0
  6931
Bugs:
sl@0
  6932
sl@0
  6933
 Does not support any attribute to find out the sub-directories
sl@0
  6934
(i.e., attribute _A_SUBDIR not supported).
sl@0
  6935
 
sl@0
  6936
sl@0
  6937
@publishedAll
sl@0
  6938
@released
sl@0
  6939
*/
sl@0
  6940
sl@0
  6941
/** @fn  findclose(intptr_t handle)
sl@0
  6942
@param handle
sl@0
  6943
sl@0
  6944
Refer to wfindfirst() for the documentation
sl@0
  6945
sl@0
  6946
sl@0
  6947
 
sl@0
  6948
sl@0
  6949
@publishedAll
sl@0
  6950
@released
sl@0
  6951
*/
sl@0
  6952
sl@0
  6953
/** @fn  wcsnicmp(const wchar_t *wcs1, const wchar_t *wcs2, size_t n)
sl@0
  6954
@param wcs1
sl@0
  6955
@param wcs2
sl@0
  6956
@param n
sl@0
  6957
sl@0
  6958
  The wcsnicmp() function
sl@0
  6959
compares the first n characters from two null-terminated wide-character strings wcs1 and wcs2, by converting them into lower-case.
sl@0
  6960
It returns an integer value indicating the status of
sl@0
  6961
the comparision.
sl@0
  6962
sl@0
  6963
@return   The wcsnicmp() returns an integer greater than, equal to, or less than 0,
sl@0
  6964
according as wcs1 is lexicographically greater than, equal to, or less than wcs2 after translation of each corresponding character to lower-case.
sl@0
  6965
The strings themselves are not modified.
sl@0
  6966
sl@0
  6967
Examples:
sl@0
  6968
@code
sl@0
  6969
#include <wchar.h>
sl@0
  6970
/* Illustrates how to use wcsnicmp API */
sl@0
  6971
int example_wcsnicmp(void)
sl@0
  6972
{ 
sl@0
  6973
  /* input strings which needs to be compared */
sl@0
  6974
  wchar_t *ws1=L"testcasecmp";
sl@0
  6975
  wchar_t *ws2=L"TESTCASECMP";
sl@0
  6976
    
sl@0
  6977
  /* function call to compare the two strings which */
sl@0
  6978
  /* differ in case */
sl@0
  6979
  int retval = wcsnicmp(ws1,ws2,12);
sl@0
  6980
  /* returns 0 if they are equal or > 1 */
sl@0
  6981
  /* if first string is greater than second string else -1 */
sl@0
  6982
  return retval;
sl@0
  6983
}
sl@0
  6984
sl@0
  6985
@endcode
sl@0
  6986
@see strcasecmp()
sl@0
  6987
@see wcscasecmp()
sl@0
  6988
@see wcsncasecmp()
sl@0
  6989
sl@0
  6990
sl@0
  6991
 
sl@0
  6992
sl@0
  6993
@publishedAll
sl@0
  6994
@released
sl@0
  6995
*/
sl@0
  6996
sl@0
  6997
/** @fn  wcsicoll(const wchar_t *wcs1, const wchar_t *wcs2)
sl@0
  6998
@param wcs1
sl@0
  6999
@param wcs2
sl@0
  7000
@return   The wcsicoll function
sl@0
  7001
returns an integer greater than, equal to, or less than 0,
sl@0
  7002
if wcs1 is greater than, equal to, or less than wcs2. No return value is reserved to indicate errors;
sl@0
  7003
callers should set errno to 0 before calling wcsicoll .
sl@0
  7004
If it is non-zero upon return from wcsicoll ,
sl@0
  7005
an error has occurred.
sl@0
  7006
sl@0
  7007
  The wcsicoll function compares the null-terminated strings wcs1 and wcs2 according to the current locale collation order, by ignoring the case.
sl@0
  7008
In the "C"
sl@0
  7009
locale, wcsicoll is equivalent to wcsicmp .
sl@0
  7010
sl@0
  7011
Examples:
sl@0
  7012
@code
sl@0
  7013
#include <wchar.h>
sl@0
  7014
/* Illustrates how to use wcsicoll API */
sl@0
  7015
int example_wcsicoll (void)
sl@0
  7016
{  
sl@0
  7017
        /* compares the two strings */
sl@0
  7018
  if( wcsicoll(L"abcdef",L"abcdeg") != L'f'-L'g')  
sl@0
  7019
   return -1;
sl@0
  7020
 return 0;
sl@0
  7021
}
sl@0
  7022
sl@0
  7023
@endcode
sl@0
  7024
sl@0
  7025
Limitations:
sl@0
  7026
sl@0
  7027
The current implementation of wcsicoll is not affected by the LC_CTYPE category of the current locale. It is equivalent to wcsicmp in this implementation.
sl@0
  7028
sl@0
  7029
@see setlocale()
sl@0
  7030
@see strcoll()
sl@0
  7031
@see wcsicmp()
sl@0
  7032
@see wcsxfrm()
sl@0
  7033
sl@0
  7034
sl@0
  7035
Bugs:
sl@0
  7036
sl@0
  7037
The current implementation of wcsicoll only works in single-byte LC_CTYPE locales, and falls back to using wcsicmp in locales with extended character sets. 
sl@0
  7038
sl@0
  7039
 
sl@0
  7040
sl@0
  7041
@publishedAll
sl@0
  7042
@released
sl@0
  7043
*/
sl@0
  7044
sl@0
  7045
/** @fn  wcsncoll(const wchar_t *wcs1, const wchar_t *wcs2, size_t n)
sl@0
  7046
@param wcs1
sl@0
  7047
@param wcs2
sl@0
  7048
@param n
sl@0
  7049
@return   The wcsncoll function
sl@0
  7050
returns an integer greater than, equal to, or less than 0,
sl@0
  7051
if wcs1 is greater than, equal to, or less than wcs2 . No return value is reserved to indicate errors;
sl@0
  7052
callers should set errno to 0 before calling wcsncoll .
sl@0
  7053
If it is non-zero upon return from wcsncoll ,
sl@0
  7054
an error has occurred.
sl@0
  7055
sl@0
  7056
  The wcsncoll function compares the first n chars from the two null-terminated strings wcs1 and wcs2 according to the current locale collation order.
sl@0
  7057
In the "C"
sl@0
  7058
locale, wcsncoll is equivalent to wcscmp .
sl@0
  7059
sl@0
  7060
Examples:
sl@0
  7061
@code
sl@0
  7062
#include <wchar.h>
sl@0
  7063
/* Illustrates how to use wcsncoll API */
sl@0
  7064
int example_wcsncoll (void)
sl@0
  7065
{  
sl@0
  7066
        /* compares the two strings */
sl@0
  7067
  if( wcsncoll(L"abcdef",L"abcdeg",7) != L'f'-L'g')  
sl@0
  7068
   return -1;
sl@0
  7069
 return 0;
sl@0
  7070
}
sl@0
  7071
sl@0
  7072
@endcode
sl@0
  7073
sl@0
  7074
Limitations:
sl@0
  7075
sl@0
  7076
The current implementation of wcsncoll is not affected by the LC_CTYPE category of the current locale. It is equivalent to wcscoll in this implementation.
sl@0
  7077
sl@0
  7078
@see setlocale()
sl@0
  7079
@see strcoll()
sl@0
  7080
@see wcscoll()
sl@0
  7081
@see wcsncmp()
sl@0
  7082
@see wcsxfrm()
sl@0
  7083
sl@0
  7084
sl@0
  7085
sl@0
  7086
Bugs:
sl@0
  7087
sl@0
  7088
 The current implementation of wcsncoll only works in single-byte LC_CTYPE locales, and falls back to using wcscoll in locales with extended character sets. 
sl@0
  7089
sl@0
  7090
 
sl@0
  7091
sl@0
  7092
@publishedAll
sl@0
  7093
@released
sl@0
  7094
*/
sl@0
  7095
sl@0
  7096
sl@0
  7097
/** @fn  wcsnicoll(const wchar_t *wcs1, const wchar_t *wcs2, size_t n)
sl@0
  7098
@param wcs1
sl@0
  7099
@param wcs2
sl@0
  7100
@param n
sl@0
  7101
@return   The wcsnicoll function
sl@0
  7102
returns an integer greater than, equal to, or less than 0,
sl@0
  7103
if wcs1 is greater than, equal to, or less than wcs2 . No return value is reserved to indicate errors;
sl@0
  7104
callers should set errno to 0 before calling wcsnicoll .
sl@0
  7105
If it is non-zero upon return from wcsnicoll ,
sl@0
  7106
an error has occurred.
sl@0
  7107
sl@0
  7108
  The wcsnicoll function compares the null-terminated strings wcs1 and wcs2 according to the current locale collation order.
sl@0
  7109
In the "C"
sl@0
  7110
locale, wcsnicoll is equivalent to wcsncasecmp .
sl@0
  7111
sl@0
  7112
Examples:
sl@0
  7113
@code
sl@0
  7114
#include <wchar.h>
sl@0
  7115
/* Illustrates how to use wcsnicoll API */
sl@0
  7116
int example_wcsnicoll (void)
sl@0
  7117
{  
sl@0
  7118
        /* compares the two strings */
sl@0
  7119
  if( wcsnicoll(L"abcdef",L"abcdeg",7) != L'f'-L'g')  
sl@0
  7120
   return -1;
sl@0
  7121
 return 0;
sl@0
  7122
}
sl@0
  7123
sl@0
  7124
@endcode
sl@0
  7125
sl@0
  7126
Limitations:
sl@0
  7127
sl@0
  7128
The current implementation of wcsnicoll is not affected by the LC_CTYPE category of the current locale. It is equivalent to wcsncasecmp in this implementation.
sl@0
  7129
sl@0
  7130
@see setlocale()
sl@0
  7131
@see strcoll()
sl@0
  7132
@see wcscmp()
sl@0
  7133
@see wcsxfrm()
sl@0
  7134
@see wcsncasecmp()
sl@0
  7135
sl@0
  7136
sl@0
  7137
Bugs:
sl@0
  7138
sl@0
  7139
 The current implementation of wcsnicoll only works in single-byte LC_CTYPE locales, and falls back to using wcsncoll in locales with extended character sets. 
sl@0
  7140
 
sl@0
  7141
sl@0
  7142
@publishedAll
sl@0
  7143
@released
sl@0
  7144
*/
sl@0
  7145
sl@0
  7146
sl@0
  7147
/** @fn  wtmpnam(wchar_t *s)
sl@0
  7148
@param s
sl@0
  7149
@return   The wtmpnam function returns a pointer to a file name on success and a NULL pointer on error.
sl@0
  7150
sl@0
  7151
  The wtmpnam function returns a pointer to a file name in the P_tmpdir directory which did not reference an existing file at some 
sl@0
  7152
indeterminate point in the past. P_tmpdir is defined in the include file stdio.h . If the argument s is non-NULL, the file name is copied to the buffer it references. Otherwise, the 
sl@0
  7153
file name is copied to a static buffer. In either case, wtmpnam returns a pointer to the file name.
sl@0
  7154
sl@0
  7155
 The buffer referenced by s is expected to be at least L_tmpnam bytes in length. L_tmpnam is defined in the include file stdio.h .
sl@0
  7156
sl@0
  7157
 The environment variable TMPDIR (if set), the argument tmpdir (if non-NULL), the directory P_tmpdir , and the directory /tmp are tried in that order as directories in which to store the 
sl@0
  7158
  temporary file.
sl@0
  7159
sl@0
  7160
sl@0
  7161
sl@0
  7162
Examples:
sl@0
  7163
@code
sl@0
  7164
#include<stdio.h> //wtmpnam
sl@0
  7165
#include<sys/stat.h> //S_IWUSR
sl@0
  7166
#include<errno.h> //errno
sl@0
  7167
  
sl@0
  7168
int main()
sl@0
  7169
{
sl@0
  7170
 //create a directory c:\system emp
sl@0
  7171
 wmkdir(L"c:\system\temp", S_IWUSR);
sl@0
  7172
  
sl@0
  7173
 wchar_t wbuf[L_tmpnam];
sl@0
  7174
 wchar_t rbuf[10];
sl@0
  7175
  
sl@0
  7176
 //call wtmpnam() to create a file
sl@0
  7177
 wchar_t *rval = wtmpnam(wbuf);
sl@0
  7178
  
sl@0
  7179
 errno = 0;
sl@0
  7180
 //open the file with the name returned by wtmpnam()
sl@0
  7181
 FILE *fp = wfopen(buf, L"w");
sl@0
  7182
  
sl@0
  7183
 if (fp == NULL)
sl@0
  7184
 {
sl@0
  7185
     printf("fopen of file returned by wtmpnam() failed - errno %d ", errno);
sl@0
  7186
     return -1;
sl@0
  7187
 }
sl@0
  7188
    
sl@0
  7189
 if(fp)
sl@0
  7190
 {
sl@0
  7191
    fwprintf(fp, L"%ls", L"check");
sl@0
  7192
    fclose(fp);
sl@0
  7193
 }
sl@0
  7194
   
sl@0
  7195
 fp = wfopen(buf, L"r");
sl@0
  7196
  
sl@0
  7197
 if(fp)
sl@0
  7198
 {
sl@0
  7199
     fwscanf(fp, L"%ls", rbuf);
sl@0
  7200
     fclose(fp);
sl@0
  7201
 }
sl@0
  7202
  
sl@0
  7203
 printf("read from file: %ls
sl@0
  7204
", rbuf);
sl@0
  7205
 printf("argument buf: %ls
sl@0
  7206
", buf);
sl@0
  7207
 printf("return value: %ls
sl@0
  7208
", rval);
sl@0
  7209
  
sl@0
  7210
 return 0;
sl@0
  7211
}
sl@0
  7212
sl@0
  7213
@endcode
sl@0
  7214
 Output
sl@0
  7215
@code
sl@0
  7216
read from file: check
sl@0
  7217
argument buf: /System/temp/tmp.0.U9UPTx
sl@0
  7218
return value: /System/temp/tmp.0.U9UPTx
sl@0
  7219
sl@0
  7220
@endcode
sl@0
  7221
@see mktemp()
sl@0
  7222
@see tmpnam()
sl@0
  7223
sl@0
  7224
sl@0
  7225
 
sl@0
  7226
sl@0
  7227
@publishedAll
sl@0
  7228
@released
sl@0
  7229
*/
sl@0
  7230
sl@0
  7231
sl@0
  7232
sl@0
  7233
/** @typedef typedef	__mbstate_t	mbstate_t
sl@0
  7234
sl@0
  7235
An object type other than an array type that can hold the conversion state information necessary to convert between sequences of (possibly multibyte) characters and wide-characters. 
sl@0
  7236
If a codeset is being used such that an mbstate_t needs to preserve more than 2 levels of reserved state, the results are unspecified.
sl@0
  7237
sl@0
  7238
@publishedAll
sl@0
  7239
@externallyDefinedApi
sl@0
  7240
*/
sl@0
  7241
sl@0
  7242
sl@0
  7243
/** @typedef typedef	__wint_t	wint_t
sl@0
  7244
sl@0
  7245
An integral type capable of storing any valid value of wchar_t, or WEOF.
sl@0
  7246
sl@0
  7247
@publishedAll
sl@0
  7248
@externallyDefinedApi
sl@0
  7249
*/
sl@0
  7250
sl@0
  7251
sl@0
  7252
/** @def WCHAR_MIN
sl@0
  7253
sl@0
  7254
The minimum value representable by an object of type wchar_t.
sl@0
  7255
sl@0
  7256
@publishedAll
sl@0
  7257
@externallyDefinedApi
sl@0
  7258
*/
sl@0
  7259
sl@0
  7260
/** @def WCHAR_MAX
sl@0
  7261
sl@0
  7262
The maximum value representable by an object of type wchar_t.
sl@0
  7263
sl@0
  7264
@publishedAll
sl@0
  7265
@externallyDefinedApi
sl@0
  7266
*/
sl@0
  7267
sl@0
  7268
/** @def WEOF 
sl@0
  7269
sl@0
  7270
Constant expression of type wint_t that is returned by several WP functions to indicate end-of-file.
sl@0
  7271
sl@0
  7272
@publishedAll
sl@0
  7273
@externallyDefinedApi
sl@0
  7274
*/
sl@0
  7275
sl@0
  7276
/** @fn wpopen3 (const wchar_t* file, const wchar_t* cmd, wchar_t** env, int fids[3])
sl@0
  7277
@param file
sl@0
  7278
@param cmd
sl@0
  7279
@param env
sl@0
  7280
@param fids
sl@0
  7281
sl@0
  7282
Note:wpopen3 is a wide-character version of popen3()
sl@0
  7283
sl@0
  7284
@return Upon successful completion, it returns pid of the child.
sl@0
  7285
sl@0
  7286
Examples:
sl@0
  7287
sl@0
  7288
@code
sl@0
  7289
sl@0
  7290
/* Illustrates how to use wpopen3 API */
sl@0
  7291
#include <wchar.h>
sl@0
  7292
int main()
sl@0
  7293
	{
sl@0
  7294
	int fds[3];
sl@0
  7295
	int childid= wpopen3( NULL,NULL, NULL, fds);
sl@0
  7296
	if  (childid == -1 && errno == ENOENT) 
sl@0
  7297
		{        
sl@0
  7298
      	printf("wpopen success");
sl@0
  7299
		return 0;
sl@0
  7300
		}
sl@0
  7301
	return -1;
sl@0
  7302
	}
sl@0
  7303
@endcode
sl@0
  7304
@code
sl@0
  7305
Output:
sl@0
  7306
wpopen success
sl@0
  7307
@endcode
sl@0
  7308
sl@0
  7309
@publishedAll
sl@0
  7310
@released
sl@0
  7311
*/