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

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

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

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

If the stream is at end-of-file, the end-of-file indicator for the stream is set andgetc returns EOF. If a read error occurs, the error indicator for the stream is set andgetc returns EOF.7.19.7.6 The getchar functionSynopsis1#include <stdio.h>int getchar(void);Description2The getchar function is equivalent to getc with the argument stdin.Returns3The getchar function returns the next character from the input stream pointed to bystdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set andgetchar returns EOF. If a read error occurs, the error indicator for the stream is set andgetchar returns EOF.7.19.7.7 The gets functionSynopsis1#include <stdio.h>char *gets(char *s);Description2The gets function reads characters from the input stream pointed to by stdin, into thearray pointed to by s, until end-of-file is encountered or a new-line character is read.Any new-line character is discarded, and a null character is written immediately after thelast character read into the array.Returns3The gets function returns s if successful.

If end-of-file is encountered and nocharacters have been read into the array, the contents of the array remain unchanged and anull pointer is returned. If a read error occurs during the operation, the array contents areindeterminate and a null pointer is returned.Forward references: future library directions (7.26.9).298Library§7.19.7.7WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.19.7.8 The putc functionSynopsis1#include <stdio.h>int putc(int c, FILE *stream);Description2The putc function is equivalent to fputc, except that if it is implemented as a macro, itmay evaluate stream more than once, so that argument should never be an expressionwith side effects.Returns3The putc function returns the character written. If a write error occurs, the errorindicator for the stream is set and putc returns EOF.7.19.7.9 The putchar functionSynopsis1#include <stdio.h>int putchar(int c);Description2The putchar function is equivalent to putc with the second argument stdout.Returns3The putchar function returns the character written.

If a write error occurs, the errorindicator for the stream is set and putchar returns EOF.7.19.7.10 The puts functionSynopsis1#include <stdio.h>int puts(const char *s);Description2The puts function writes the string pointed to by s to the stream pointed to by stdout,and appends a new-line character to the output. The terminating null character is notwritten.Returns3The puts function returns EOF if a write error occurs; otherwise it returns a nonnegativevalue.§7.19.7.10Library299ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.19.7.11 The ungetc functionSynopsis1#include <stdio.h>int ungetc(int c, FILE *stream);Description2The ungetc function pushes the character specified by c (converted to an unsignedchar) back onto the input stream pointed to by stream. Pushed-back characters will bereturned by subsequent reads on that stream in the reverse order of their pushing.

Asuccessful intervening call (with the stream pointed to by stream) to a file positioningfunction (fseek, fsetpos, or rewind) discards any pushed-back characters for thestream. The external storage corresponding to the stream is unchanged.3One character of pushback is guaranteed. If the ungetc function is called too manytimes on the same stream without an intervening read or file positioning operation on thatstream, the operation may fail.4If the value of c equals that of the macro EOF, the operation fails and the input stream isunchanged.5A successful call to the ungetc function clears the end-of-file indicator for the stream.The value of the file position indicator for the stream after reading or discarding allpushed-back characters shall be the same as it was before the characters were pushedback.

For a text stream, the value of its file position indicator after a successful call to theungetc function is unspecified until all pushed-back characters are read or discarded.For a binary stream, its file position indicator is decremented by each successful call tothe ungetc function; if its value was zero before a call, it is indeterminate after thecall.256)Returns6The ungetc function returns the character pushed back after conversion, or EOF if theoperation fails.Forward references: file positioning functions (7.19.9).256) See ‘‘future library directions’’ (7.26.9).300Library§7.19.7.11WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.19.8 Direct input/output functions7.19.8.1 The fread functionSynopsis1#include <stdio.h>size_t fread(void * restrict ptr,size_t size, size_t nmemb,FILE * restrict stream);Description2The fread function reads, into the array pointed to by ptr, up to nmemb elementswhose size is specified by size, from the stream pointed to by stream.

For eachobject, size calls are made to the fgetc function and the results stored, in the orderread, in an array of unsigned char exactly overlaying the object. The file positionindicator for the stream (if defined) is advanced by the number of characters successfullyread. If an error occurs, the resulting value of the file position indicator for the stream isindeterminate. If a partial element is read, its value is indeterminate.Returns3The fread function returns the number of elements successfully read, which may beless than nmemb if a read error or end-of-file is encountered.

If size or nmemb is zero,fread returns zero and the contents of the array and the state of the stream remainunchanged.7.19.8.2 The fwrite functionSynopsis1#include <stdio.h>size_t fwrite(const void * restrict ptr,size_t size, size_t nmemb,FILE * restrict stream);Description2The fwrite function writes, from the array pointed to by ptr, up to nmemb elementswhose size is specified by size, to the stream pointed to by stream. For each object,size calls are made to the fputc function, taking the values (in order) from an array ofunsigned char exactly overlaying the object.

The file position indicator for thestream (if defined) is advanced by the number of characters successfully written. If anerror occurs, the resulting value of the file position indicator for the stream isindeterminate.§7.19.8.2Library301ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Returns3The fwrite function returns the number of elements successfully written, which will beless than nmemb only if a write error is encountered. If size or nmemb is zero,fwrite returns zero and the state of the stream remains unchanged.7.19.9 File positioning functions7.19.9.1 The fgetpos functionSynopsis1#include <stdio.h>int fgetpos(FILE * restrict stream,fpos_t * restrict pos);Description2The fgetpos function stores the current values of the parse state (if any) and fileposition indicator for the stream pointed to by stream in the object pointed to by pos.The values stored contain unspecified information usable by the fsetpos function forrepositioning the stream to its position at the time of the call to the fgetpos function.Returns3If successful, the fgetpos function returns zero; on failure, the fgetpos functionreturns nonzero and stores an implementation-defined positive value in errno.Forward references: the fsetpos function (7.19.9.3).7.19.9.2 The fseek functionSynopsis1#include <stdio.h>int fseek(FILE *stream, long int offset, int whence);Description2The fseek function sets the file position indicator for the stream pointed to by stream.If a read or write error occurs, the error indicator for the stream is set and fseek fails.3For a binary stream, the new position, measured in characters from the beginning of thefile, is obtained by adding offset to the position specified by whence.

The specifiedposition is the beginning of the file if whence is SEEK_SET, the current value of the fileposition indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need notmeaningfully support fseek calls with a whence value of SEEK_END.4For a text stream, either offset shall be zero, or offset shall be a value returned byan earlier successful call to the ftell function on a stream associated with the same fileand whence shall be SEEK_SET.302Library§7.19.9.2WG14/N12565Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3After determining the new position, a successful call to the fseek function undoes anyeffects of the ungetc function on the stream, clears the end-of-file indicator for thestream, and then establishes the new position.

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

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

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

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