Sams Teach Yourself C in 21 Days
Deleting from a Linked List The capability to add information to a linked list is essential, but there will be times when you wi ...
Pointers: Beyond the Basics 435 15 Q Is there a difference between a pointer to a string and a pointer to an array of characters ...
Continuing with the array declared in question 3, what does the expression array[0][0]mean? Again using the array from question ...
Pointers: Beyond the Basics 437 15 Exercises ................................................................................... ...
25 448201x-CH15 8/13/02 11:13 AM Page 438 ...
DAY 16 WEEK 3 Using Disk Files Most of the programs you write will use files written to a hard drive. These files will contain i ...
such as the keyboard, screen, and (on some systems) the printer. Disk file streams work essentially the same way. This is one of ...
Using Disk Files 441 16 Windows (including NT, XP, and .NET), as well as most UNIX systems, permit file- names up to 256 charact ...
the program), writing (meaning that data from the program is saved in the file), or both. When you’re done using the file, you m ...
Using Disk Files 443 16 The default file mode is text. To open a file in binary mode, you append a bto the mode argument. Thus, ...
24: printf(“\nSuccessful opening %s in mode %s.\n”, 25: filename, mode); 26: fclose(fp); 27: puts(“Enter x to exit, any other to ...
Using Disk Files 445 16 You can experiment with different names and modes to see which ones give you an error. In the output jus ...
with the printf()andscanf()functions, as described on Day 14. We’ll discuss format- ted output first, followed by input. Formatt ...
Using Disk Files 447 16 16: for (count = 0; count < 5; count++) 17: scanf(“%f”, &data[count]); 18: 19: /* Get the filenam ...
You might wonder why the program displays 1000.000122when the value entered was 1000.0001. This isn’t an error in the program. I ...
Using Disk Files 449 16 LISTING16.3 fscanf.c. Using fscanf()to read formatted data from a disk file 1: /* Reading formatted file ...
Character Input and Output .......................................................................... When used with disk files, ...
Using Disk Files 451 16 allocated for the buffer str, you prevent input from overwriting memory beyond allo- cated space. (The n ...
a new line to the end of the string; if you want it, you must explicitly include it. Its pro- totype in stdio.h is char fputs(ch ...
Using Disk Files 453 16 To write an array data[]of 50 structures of type addressto a file, you have two choices: fwrite(data, si ...
«
19
20
21
22
23
24
25
26
27
28
»
Free download pdf