Advanced Programming in the UNIX® Environment
ptg10805159 Section 5.4 Buffering 147 Withsetbuf, we can turn buffering on or off. Toenable buffering,bufmust point to a buffer ...
ptg10805159 148 StandardI/O Library Chapter 5 5.5 OpeningaStream Thefopen,freopen,andfdopenfunctions open a standardI/O stream. ...
ptg10805159 Section 5.5 Opening a Stream 149 text file and a binary file. Since the UNIX kernel doesn’t differentiate between th ...
ptg10805159 150 StandardI/O Library Chapter 5 any other operation on the stream, we can change the buffering if we want to, with ...
ptg10805159 Section 5.6 Reading and Writing a Stream 151 The functiongetcharis defined to be equivalent togetc(stdin).The differ ...
ptg10805159 152 StandardI/O Library Chapter 5 The character that we push back does not have to be the same character that was re ...
ptg10805159 Section 5.8 StandardI/O Efficiency 153 buffer.The buffer is terminated with a null byte. If the line, including the ...
ptg10805159 154 StandardI/O Library Chapter 5 #include "apue.h" int main(void) { int c; while ((c = getc(stdin)) != EOF) if (put ...
ptg10805159 Section 5.8 StandardI/O Efficiency 155 User CPU System CPU Clock time Bytes of Function (seconds) (seconds) (seconds ...
ptg10805159 156 StandardI/O Library Chapter 5 library is not much slower than calling thereadandwritefunctions directly.For most ...
ptg10805159 Section 5.10 Positioning a Stream 157 The obvious generalization of these two cases is to read or write an array of ...
ptg10805159 158 StandardI/O Library Chapter 5 #include <stdio.h> long ftell(FILE *fp); Returns: current file position indi ...
ptg10805159 Section 5.11Formatted I/O 159 Thefgetposfunction stores the current value of the file’s position indicator in the ob ...
ptg10805159 160 StandardI/O Library Chapter 5 specifications, other characters in the format arecopied unmodified. Aconversion s ...
ptg10805159 Section 5.11Formatted I/O 161 Conversion Description type d,i signed decimal o unsigned octal u unsigned decimal x,X ...
ptg10805159 162 StandardI/O Library Chapter 5 Refer to Section 7.3 of Kernighan and Ritchie[ 1988 ] for additional details on ha ...
ptg10805159 Section 5.11Formatted I/O 163 Conversion Description type d signed decimal, base 10 i signed decimal, base determine ...
ptg10805159 164 StandardI/O Library Chapter 5 5.12 Implementation Details As we’ve mentioned, under the UNIX System, the standar ...
ptg10805159 Section 5.12 Implementation Details 165 if ((fp = fopen("/etc/passwd", "r")) == NULL) err_sys("fopen error"); if (ge ...
ptg10805159 166 StandardI/O Library Chapter 5 int is_linebuffered(FILE *fp) { return(fp->_flags & __SLBF); } int buffer_s ...
«
5
6
7
8
9
10
11
12
13
14
»
Free download pdf