• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "securec.h"
17 
18 /*******************************************************************************
19  * <FUNCTION DESCRIPTION>
20  *    The fwscanf_s function  is  the  wide-character  equivalent  of the fscanf_s function
21  *    The fwscanf_s function reads data from the current position of stream into
22  *    the locations given by argument (if any). Each argument must be a pointer
23  *    to a variable of a type that corresponds to a type specifier in format.
24  *    format controls the interpretation of the input fields and has the same
25  *    form and function as the format argument for scanf; see scanf for a
26  *    description of format.
27  *
28  * <INPUT PARAMETERS>
29  *    stream                   Pointer to FILE structure.
30  *    format                   Format control string, see Format Specifications.
31  *    ...                      Optional arguments.
32  *
33  * <OUTPUT PARAMETERS>
34  *    ...                      The converted value stored in user assigned address
35  *
36  * <RETURN VALUE>
37  *    Each of these functions returns the number of fields successfully converted
38  *    and assigned; the return value does not include fields that were read but
39  *    not assigned. A return value of 0 indicates that no fields were assigned.
40  *    A value of -1 indicates that an error has occurred.
41  *******************************************************************************
42  */
fwscanf_s(FILE * stream,const wchar_t * format,...)43 int fwscanf_s(FILE *stream, const wchar_t *format, ...)
44 {
45     int ret;                    /* If initialization causes  e838 */
46     va_list arglist;
47 
48     va_start(arglist, format);
49     ret = vfwscanf_s(stream, format, arglist);
50     va_end(arglist);
51     (void)arglist;              /* to clear e438 last value assigned not used , the compiler will optimize this code */
52 
53     return ret;
54 }
55 
56