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

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

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

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

If the program terminates abnormally, whether an open temporary file isremoved is implementation-defined. The file is opened for update with "wb+" mode.Recommended practice3It should be possible to open at least TMP_MAX temporary files during the lifetime of theprogram (this limit may be shared with tmpnam) and there should be no limit on thenumber simultaneously open other than this limit and any limit on the number of openfiles (FOPEN_MAX).Returns4The tmpfile function returns a pointer to the stream of the file that it created. If the filecannot be created, the tmpfile function returns a null pointer.Forward references: the fopen function (7.19.5.3).7.19.4.4 The tmpnam functionSynopsis1#include <stdio.h>char *tmpnam(char *s);Description2The tmpnam function generates a string that is a valid file name and that is not the sameas the name of an existing file.236) The function is potentially capable of generating235) Among the reasons the implementation may cause the rename function to fail are that the file is openor that it is necessary to copy its contents to effectuate its renaming.236) Files created using strings generated by the tmpnam function are temporary only in the sense thattheir names should not collide with those generated by conventional naming rules for theimplementation.

It is still necessary to use the remove function to remove such files when their useis ended, and before program termination.§7.19.4.4Library269ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256TMP_MAX different strings, but any or all of them may already be in use by existing filesand thus not be suitable return values.3The tmpnam function generates a different string each time it is called.4The implementation shall behave as if no library function calls the tmpnam function.Returns5If no suitable string can be generated, the tmpnam function returns a null pointer.Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in aninternal static object and returns a pointer to that object (subsequent calls to the tmpnamfunction may modify the same object).

If the argument is not a null pointer, it is assumedto point to an array of at least L_tmpnam chars; the tmpnam function writes its resultin that array and returns the argument as its value.Environmental limits6The value of the macro TMP_MAX shall be at least 25.7.19.5 File access functions7.19.5.1 The fclose functionSynopsis1#include <stdio.h>int fclose(FILE *stream);Description2A successful call to the fclose function causes the stream pointed to by stream to beflushed and the associated file to be closed.

Any unwritten buffered data for the streamare delivered to the host environment to be written to the file; any unread buffered dataare discarded. Whether or not the call succeeds, the stream is disassociated from the fileand any buffer set by the setbuf or setvbuf function is disassociated from the stream(and deallocated if it was automatically allocated).Returns3The fclose function returns zero if the stream was successfully closed, or EOF if anyerrors were detected.7.19.5.2 The fflush functionSynopsis1#include <stdio.h>int fflush(FILE *stream);270Library§7.19.5.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Description2If stream points to an output stream or an update stream in which the most recentoperation was not input, the fflush function causes any unwritten data for that streamto be delivered to the host environment to be written to the file; otherwise, the behavior isundefined.3If stream is a null pointer, the fflush function performs this flushing action on allstreams for which the behavior is defined above.Returns4The fflush function sets the error indicator for the stream and returns EOF if a writeerror occurs, otherwise it returns zero.Forward references: the fopen function (7.19.5.3).7.19.5.3 The fopen functionSynopsis1#include <stdio.h>FILE *fopen(const char * restrict filename,const char * restrict mode);Description2The fopen function opens the file whose name is the string pointed to by filename,and associates a stream with it.3The argument mode points to a string.

If the string is one of the following, the file isopen in the indicated mode. Otherwise, the behavior is undefined.237)rwarbwbabr+w+a+open text file for readingtruncate to zero length or create text file for writingappend; open or create text file for writing at end-of-fileopen binary file for readingtruncate to zero length or create binary file for writingappend; open or create binary file for writing at end-of-fileopen text file for update (reading and writing)truncate to zero length or create text file for updateappend; open or create text file for update, writing at end-of-file237) If the string begins with one of the above sequences, the implementation might choose to ignore theremaining characters, or it might use them to select different kinds of a file (some of which might notconform to the properties in 7.19.2).§7.19.5.3Library271ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256r+b or rb+ open binary file for update (reading and writing)w+b or wb+ truncate to zero length or create binary file for updatea+b or ab+ append; open or create binary file for update, writing at end-of-file4Opening a file with read mode ('r' as the first character in the mode argument) fails ifthe file does not exist or cannot be read.5Opening a file with append mode ('a' as the first character in the mode argument)causes all subsequent writes to the file to be forced to the then current end-of-file,regardless of intervening calls to the fseek function.

In some implementations, openinga binary file with append mode ('b' as the second or third character in the above list ofmode argument values) may initially position the file position indicator for the streambeyond the last data written, because of null character padding.6When a file is opened with update mode ('+' as the second or third character in theabove list of mode argument values), both input and output may be performed on theassociated stream. However, output shall not be directly followed by input without anintervening call to the fflush function or to a file positioning function (fseek,fsetpos, or rewind), and input shall not be directly followed by output without anintervening call to a file positioning function, unless the input operation encounters endof-file.

Opening (or creating) a text file with update mode may instead open (or create) abinary stream in some implementations.7When opened, a stream is fully buffered if and only if it can be determined not to refer toan interactive device. The error and end-of-file indicators for the stream are cleared.Returns8The fopen function returns a pointer to the object controlling the stream. If the openoperation fails, fopen returns a null pointer.Forward references: file positioning functions (7.19.9).7.19.5.4 The freopen functionSynopsis1#include <stdio.h>FILE *freopen(const char * restrict filename,const char * restrict mode,FILE * restrict stream);Description2The freopen function opens the file whose name is the string pointed to by filenameand associates the stream pointed to by stream with it. The mode argument is used just272Library§7.19.5.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3as in the fopen function.238)3If filename is a null pointer, the freopen function attempts to change the mode ofthe stream to that specified by mode, as if the name of the file currently associated withthe stream had been used.

It is implementation-defined which changes of mode arepermitted (if any), and under what circumstances.4The freopen function first attempts to close any file that is associated with the specifiedstream. Failure to close the file is ignored. The error and end-of-file indicators for thestream are cleared.Returns5The freopen function returns a null pointer if the open operation fails. Otherwise,freopen returns the value of stream.7.19.5.5 The setbuf functionSynopsis1#include <stdio.h>void setbuf(FILE * restrict stream,char * restrict buf);Description2Except that it returns no value, the setbuf function is equivalent to the setvbuffunction invoked with the values _IOFBF for mode and BUFSIZ for size, or (if bufis a null pointer), with the value _IONBF for mode.Returns3The setbuf function returns no value.Forward references: the setvbuf function (7.19.5.6).7.19.5.6 The setvbuf functionSynopsis1#include <stdio.h>int setvbuf(FILE * restrict stream,char * restrict buf,int mode, size_t size);238) The primary use of the freopen function is to change the file associated with a standard text stream(stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the valuereturned by the fopen function may be assigned.§7.19.5.6Library273ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Description2The setvbuf function may be used only after the stream pointed to by stream hasbeen associated with an open file and before any other operation (other than anunsuccessful call to setvbuf) is performed on the stream.

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

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

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

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