Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 66

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 66 страницаСтандарт языка Си С99 TC (1113411) страница 662019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 66)

Characters from the array are converted asif by repeated calls to the mbrtowc function, with the conversion statedescribed by an mbstate_t object initialized to zero before the firstmultibyte character is converted, and written up to (but not including) theterminating null wide character. If the precision is specified, no more thanthat many wide characters are written. If the precision is not specified or isgreater than the size of the converted array, the converted array shall contain anull wide character.If an l length modifier is present, the argument shall be a pointer to the initialelement of an array of wchar_t type.

Wide characters from the array arewritten up to (but not including) a terminating null wide character. If theprecision is specified, no more than that many wide characters are written. Ifthe precision is not specified or is greater than the size of the array, the arrayshall contain a null wide character.pThe argument shall be a pointer to void. The value of the pointer isconverted to a sequence of printing wide characters, in an implementation-285) The precision p is sufficient to distinguish values of the source type if 16 p−1 > b n where b isFLT_RADIX and n is the number of base-b digits in the significand of the source type.

A smaller pmight suffice depending on the implementation’s scheme for determining the digit to the left of thedecimal-point wide character.354Library§7.24.2.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3defined manner.nThe argument shall be a pointer to signed integer into which is written thenumber of wide characters written to the output stream so far by this call tofwprintf. No argument is converted, but one is consumed.

If theconversion specification includes any flags, a field width, or a precision, thebehavior is undefined.%A % wide character is written. No argument is converted. The completeconversion specification shall be %%.9If a conversion specification is invalid, the behavior is undefined.286) If any argument isnot the correct type for the corresponding conversion specification, the behavior isundefined.10In no case does a nonexistent or small field width cause truncation of a field; if the resultof a conversion is wider than the field width, the field is expanded to contain theconversion result.11For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly roundedto a hexadecimal floating number with the given precision.Recommended practice12For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactlyrepresentable in the given precision, the result should be one of the two adjacent numbersin hexadecimal floating style with the given precision, with the extra stipulation that theerror should have a correct sign for the current rounding direction.13For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at mostDECIMAL_DIG, then the result should be correctly rounded.287) If the number ofsignificant decimal digits is more than DECIMAL_DIG but the source value is exactlyrepresentable with DECIMAL_DIG digits, then the result should be an exactrepresentation with trailing zeros.

Otherwise, the source value is bounded by twoadjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the valueof the resultant decimal string D should satisfy L ≤ D ≤ U, with the extra stipulation thatthe error should have a correct sign for the current rounding direction.Returns14The fwprintf function returns the number of wide characters transmitted, or a negativevalue if an output or encoding error occurred.286) See ‘‘future library directions’’ (7.26.12).287) For binary-to-decimal conversion, the result format’s values are the numbers representable with thegiven format specifier. The number of significant digits is determined by the format specifier, and inthe case of fixed-point conversion by the source value as well.§7.24.2.1Library355ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Environmental limits15The number of wide characters that can be produced by any single conversion shall be atleast 4095.16EXAMPLEplaces:To print a date and time in the form ‘‘Sunday, July 3, 10:02’’ followed by π to five decimal#include <math.h>#include <stdio.h>#include <wchar.h>/* ...

*/wchar_t *weekday, *month; // pointers to wide stringsint day, hour, min;fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",weekday, month, day, hour, min);fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));Forward references:(7.24.6.3.2).the btowc function (7.24.6.1.1), the mbrtowc function7.24.2.2 The fwscanf functionSynopsis1#include <stdio.h>#include <wchar.h>int fwscanf(FILE * restrict stream,const wchar_t * restrict format, ...);Description2The fwscanf function reads input from the stream pointed to by stream, undercontrol of the wide string pointed to by format that specifies the admissible inputsequences and how they are to be converted for assignment, using subsequent argumentsas pointers to the objects to receive the converted input.

If there are insufficientarguments for the format, the behavior is undefined. If the format is exhausted whilearguments remain, the excess arguments are evaluated (as always) but are otherwiseignored.3The format is composed of zero or more directives: one or more white-space widecharacters, an ordinary wide character (neither % nor a white-space wide character), or aconversion specification. Each conversion specification is introduced by the widecharacter %. After the %, the following appear in sequence:— An optional assignment-suppressing wide character *.— An optional decimal integer greater than zero that specifies the maximum field width(in wide characters).356Library§7.24.2.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3— An optional length modifier that specifies the size of the receiving object.— A conversion specifier wide character that specifies the type of conversion to beapplied.4The fwscanf function executes each directive of the format in turn.

If a directive fails,as detailed below, the function returns. Failures are described as input failures (due to theoccurrence of an encoding error or the unavailability of input characters), or matchingfailures (due to inappropriate input).5A directive composed of white-space wide character(s) is executed by reading input up tothe first non-white-space wide character (which remains unread), or until no more widecharacters can be read.6A directive that is an ordinary wide character is executed by reading the next widecharacter of the stream. If that wide character differs from the directive, the directivefails and the differing and subsequent wide characters remain unread.

Similarly, if endof-file, an encoding error, or a read error prevents a wide character from being read, thedirective fails.7A directive that is a conversion specification defines a set of matching input sequences, asdescribed below for each specifier. A conversion specification is executed in thefollowing steps:8Input white-space wide characters (as specified by the iswspace function) are skipped,unless the specification includes a [, c, or n specifier.288)9An input item is read from the stream, unless the specification includes an n specifier.

Aninput item is defined as the longest sequence of input wide characters which does notexceed any specified field width and which is, or is a prefix of, a matching inputsequence.289) The first wide character, if any, after the input item remains unread. If thelength of the input item is zero, the execution of the directive fails; this condition is amatching failure unless end-of-file, an encoding error, or a read error prevented inputfrom the stream, in which case it is an input failure.10Except in the case of a % specifier, the input item (or, in the case of a %n directive, thecount of input wide characters) is converted to a type appropriate to the conversionspecifier. If the input item is not a matching sequence, the execution of the directive fails:this condition is a matching failure.

Unless assignment suppression was indicated by a *,the result of the conversion is placed in the object pointed to by the first argumentfollowing the format argument that has not already received a conversion result. If this288) These white-space wide characters are not counted against a specified field width.289) fwscanf pushes back at most one input wide character onto the input stream. Therefore, somesequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.§7.24.2.2Library357ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256object does not have an appropriate type, or if the result of the conversion cannot berepresented in the object, the behavior is undefined.11The length modifiers and their meanings are:hhSpecifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to signed char or unsigned char.hSpecifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to short int or unsigned shortint.l (ell)Specifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to long int or unsigned longint; that a following a, A, e, E, f, F, g, or G conversion specifier applies toan argument with type pointer to double; or that a following c, s, or [conversion specifier applies to an argument with type pointer to wchar_t.ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to long long int or unsignedlong long int.jSpecifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to intmax_t or uintmax_t.zSpecifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to size_t or the corresponding signedinteger type.tSpecifies that a following d, i, o, u, x, X, or n conversion specifier appliesto an argument with type pointer to ptrdiff_t or the correspondingunsigned integer type.LSpecifies that a following a, A, e, E, f, F, g, or G conversion specifierapplies to an argument with type pointer to long double.If a length modifier appears with any conversion specifier other than as specified above,the behavior is undefined.12The conversion specifiers and their meanings are:dMatches an optionally signed decimal integer, whose format is the same asexpected for the subject sequence of the wcstol function with the value 10for the base argument.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6381
Авторов
на СтудИзбе
308
Средний доход
с одного платного файла
Обучение Подробнее