Sams Teach Yourself C in 21 Days
Q Why don’t all compilers have the same functions? AIn today’s lesson, you saw that certain C functions aren’t available with al ...
Advanced Program Control 335 13 What does the defaultstatement do? What does the exit()function do? What does the system()funct ...
21 448201x-CH13 8/13/02 11:12 AM Page 336 ...
DAY 14 WEEK 2 Working with the Screen, Printer, and Keyboard Almost every program must perform input and output. How well a prog ...
handling all input and output has definite advantages for the programmer. Of course, this makes it essential that you understand ...
Working with the Screen, Printer, and Keyboard 339 14 What Is a Stream? ........................................................ ...
TABLE14.1 The five standard streams Name Streams Device stdin Standard input Keyboard stdout Standard output Screen stderr Stand ...
Working with the Screen, Printer, and Keyboard 341 14 All these functions require that you include stdio.h. The function perror( ...
Accepting Keyboard Input .................................................................................. Most C programs requ ...
Working with the Screen, Printer, and Keyboard 343 14 10: putchar(ch); 11: 12: return 0; 13: } This is what’s typed in. This is ...
This is a string This is a string This program is similar to Listing 14.2 in the way that it uses getchar(). An extra condition ...
Working with the Screen, Printer, and Keyboard 345 14 10: while ((ch = getch()) != ‘\r’) 11: putchar(ch); 12: 13: return 0; 14: ...
14: buffer[x++] = ch; 15: 16: buffer[x] = ‘\0’; 17: 18: printf(“%s”, buffer); 19: 20: return 0; 21: } Here’s a string Here’s a s ...
Working with the Screen, Printer, and Keyboard 347 14 “Ungetting” a Character with ungetc() What does ungettinga character mean? ...
You probably can interpret this prototype by yourself. gets()takes a pointer to type charas its argument and returns a pointer t ...
Working with the Screen, Printer, and Keyboard 349 14 LISTING14.6 fgets.c. Using thefgets()function for keyboard input 1: /* Dem ...
Working with Formatted Input ...................................................................... The input functions covered ...
Working with the Screen, Printer, and Keyboard 351 14 sequence of non-whitespace characters that ends when the next white space ...
a,e,f,g float * A floating-point number. Numbers can be input in decimal or scientific notation. [...] char * A string. Only the ...
Working with the Screen, Printer, and Keyboard 353 14 processed, in order, by scanf(). Execution returns from scanf()only when e ...
«
14
15
16
17
18
19
20
21
22
23
»
Free download pdf