The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
| Version |
Location |
Description |
Submitted By |
Date Submitted |
Date Corrected |
| Printed |
Page 94
Code in int main() |
The line
fgets(search_for, 80, stdin)
Should be replaced by
scanf("%79s", search_for);
|
 Dawn Griffiths
|
Jun 02, 2013 |
|
| Printed |
Page 91/93
Bottom left function |
The line
fgets(search_for, 80, stdin)
Should be replaced by
scanf("%79s", search_for);
|
 Dawn Griffiths
|
Jun 02, 2013 |
Jun 07, 2013 |
| PDF |
Page 9
item 3 using "./" to run object module |
I am brand new to C. So I follow the book's instructions closely. I did not use the "./" in front of my compiled object module for Windows. I got a "module not found" message. Using "./" my module executed. I also found that it ran equally well with no ".exe" extension and with it. I am doing all this exclusively on my Windows 7, 64-bit laptop. My install was to C:\cygwin\
I am wondering if the cygwin version I installed is responsible for the difference. I installed the latest cygwin version 1.7.22 in November 2012.
Note from the Author or Editor: Item 3 should say:
Run by typing cards on Windows, or ./cards on Mac, Linux and Cygwin.
|
Tom Bullock |
Dec 22, 2012 |
|
| PDF |
Page 113
Sidebar |
1. Line 56 of the map.html file should read:
if ((lng < -180) || (lng > 180)) {
2. Google has invalidated the old API key used in the map.html file. A new v2 API key needs to be generated. The old API key appears on lines 12 and 16.
3. No instructions for how to get the map.html file were provided. The following works:
wget http://oreillyhfc.appspot.com/map.html
or
curl -C - -O http://oreillyhfc.appspot.com/map.html
Note from the Author or Editor: This is a change needed on the website, not the book. No changes are needed for the book.
|
BarryBrown |
Sep 18, 2012 |
|
| PDF |
Page 167
"Data Type Sizes Close Up" code |
The printf conversion character for sizeof on both int and float is incorrect.
"An int takes %z bytes\n" throws a warning (warning: unknown conversion type character 0x20 in format ), the conversion character(s) should be %zu.
It should read printf("An int takes %zu bytes\n", sizeof(int)); otherwise you get nothing for the bytes.
Note from the Author or Editor: Both instances of %z should say %zu
|
Michael Hans |
Sep 06, 2012 |
|
| ePub |
Page 2780
2nd zoomable screenshot |
Kindle version, loc 2780, the Case of the Magic Bullet. Second zoomable screenshot should say 'Masked raider is DEAD!, Jimmy is DEAD!'
Note from the Author or Editor: Kindle version should reflect printed version (page 77)
|
Peter Gustafson |
Sep 03, 2012 |
|
| Safari Books Online |
295-296
3rd description |
"you could use to me" should be replaced by "you could use me".
Note from the Author or Editor: 3rd item under Description.
|
Thomas Corbière |
Aug 18, 2012 |
Jun 07, 2013 |
| Safari Books Online |
362
2nd make file rule annotation |
"This creates the object from" should be replaced by "This creates the object file from".
|
Thomas Corbière |
Aug 18, 2012 |
|
| Safari Books Online |
377
Using Cygwin |
"If you’re compiled" should be replaced by "If you’ve compiled".
|
Thomas Corbière |
Aug 18, 2012 |
Jun 07, 2013 |
| Safari Books Online |
377
Using MinGW |
"PATH="%PATH%:C:\libs"" should be replaced by "PATH="%PATH%;C:\libs"" as Windows is using semicolon to separate paths.
|
Thomas Corbière |
Aug 18, 2012 |
|
| Safari Books Online |
412
Wording of the exercise |
All the code after the candidate code area should be removed because it will never be executed. either the exec() succeeds and the process is replaced or the exec() failed and the process will be stopped in the if statement.
Note from the Author or Editor: On pages 412 and 414 remove the following lines of code after the rectangle area for the candidate code:
fprintf...
return1;
}
return 0;
|
Thomas Corbière |
Aug 17, 2012 |
|
| Safari Books Online |
432
Geek Bits |
"&1 means “to the Standard Input.”" should be replaced by "&1 means “to the Standard Output.”"
Note from the Author or Editor: This applies to the final annotation on the page.
|
Thomas Corbière |
Aug 17, 2012 |
|
| Safari Books Online |
453
3rd paragraph |
"errno function" should be replaced by "errno variable".
Note from the Author or Editor: Should say "...will also set the errno variable"
|
Thomas Corbière |
Aug 17, 2012 |
Jun 07, 2013 |
| Safari Books Online |
455
2nd paragraph |
"handle_interrupt()" should be replaced by "diediedie()".
|
Thomas Corbière |
Aug 17, 2012 |
Jun 07, 2013 |
| Safari Books Online |
461
Annotation of catch_signal() |
"signal()" should be replaced by "catch_signal()".
|
Thomas Corbière |
Aug 17, 2012 |
|
| Safari Books Online |
479
bind_to_port() function |
"htons(30000)" should be replaced by "htons(port)". Annotation about port 30000 could be removed too.
Note from the Author or Editor: Replace htons(30000) with htons(port).
Remove annotation "name is Internet port 30000".
Change annotation "Grab port 30000" to "Grab port".
|
Thomas Corbière |
Aug 17, 2012 |
|
| Safari Books Online |
490
Code snippet in the terminal |
"http/1.1" should be in capital letters "HTTP/1.1" according to RFC2616. This should also be corrected in the explanation of the GET command on the same page.
On the class attribute of the html element, add the missing equals sign.
Note from the Author or Editor: Replace http/1.1 on this page with HTTP/1.1.
Replace class"client-nojs" with class="client-nojs".
|
Thomas Corbière |
Aug 17, 2012 |
|
| Safari Books Online |
493
Annotation for freeaddrinfo() |
In "freeaddrinf0()", replace the number '0' with the letter 'o'.
|
Thomas Corbière |
Aug 17, 2012 |
Jun 07, 2013 |
| Printed |
Page 46
Point 1,2 & 3 under section "C sends arguments as values" |
In all the mentioned points, variable named 'longitude' is said to have the value 32. But actually it is the variable named latitude that has value of 32.
For example, Point 1 says :
"Initially, the main() function has a local variable called longitude that had value 32.
this should actually be :
"Initially, the main() function has a local variable called latitude that had value 32.
Note from the Author or Editor: Throughout page 46, all references to "longitude" should say "latitude", and all references to "lon" should say "lat".
|
jainanupam |
Aug 15, 2012 |
Jun 07, 2013 |
| Safari Books Online |
165-166
exercise code |
Remove the semicolon at the end of "add_with_tax(float f);".
|
Thomas Corbière |
Aug 10, 2012 |
|
| Safari Books Online |
182, 186
encrypt function |
Remove the unused variable "char c".
Note from the Author or Editor: Remove the char c; line of code from pages 182 and 186
|
Thomas Corbière |
Aug 10, 2012 |
|
| Safari Books Online |
186
3rd paragraph |
"to the actual encrypt() function in encrypt.h" should be replaced by "to the actual encrypt() function in encrypt.c".
|
Thomas Corbière |
Aug 10, 2012 |
Jun 07, 2013 |
| Safari Books Online |
220
3rd No Dumb Questions |
"in the string" should be replaced by "in the struct".
|
Thomas Corbière |
Aug 10, 2012 |
Jun 07, 2013 |
| Safari Books Online |
249
3rd code snippet |
".weight for the .amount" should be replaced by "".weight for the union".
Note from the Author or Editor: Rephrase the annotation on the far right to:
Here, you're using a double designated identifier. It accesses the weight field of the .amount union.
|
Thomas Corbière |
Aug 09, 2012 |
|
| Safari Books Online |
269-270
Wording of "Sharpen your pencil" |
" from one of piece of data" should be replaced by " from one piece of data".
|
Thomas Corbière |
Aug 09, 2012 |
Jun 07, 2013 |
| Safari Books Online |
147
1st annotation |
"If you run elvises.txt" should be changed to "If you run elvises.csv".
Note from the Author or Editor: Correct. The top right annotation should refer to elvises.csv.
|
Thomas Corbière |
Aug 07, 2012 |
|
| Safari Books Online |
139
Code snippet |
The code is missing an fclose() for the "in" stream. Same error on pages 140, 143 and 145.
Note from the Author or Editor: On pages 139, 140, 143, 145, add the following line of code immediately before the return 0;
fclose(in);
|
Thomas Corbière |
Aug 07, 2012 |
|
| Safari Books Online |
128
1st paragraph |
"then chances are you going" should be changed to "then chances are you're going".
|
Thomas Corbière |
Aug 07, 2012 |
Jun 07, 2013 |
| Safari Books Online |
94
First annotation |
"You still need to stdio.h" should be changed to "You still need stdio.h".
|
Thomas Corbière |
Aug 07, 2012 |
Jun 07, 2013 |
| Safari Books Online |
93
Annotation of the fourth solution |
It's true that the solution is incorrect but I think that the main reason is that the parameters is not those expected by scanf() so the string length problem is irrelevant. Did you intend to write scanf("%80s", search_for)?
Note from the Author or Editor: Replace:
scanf(search_for, 80, stdin)
with
scanf("%80s", search_for)
|
Thomas Corbière |
Aug 07, 2012 |
Jun 07, 2013 |
| Safari Books Online |
88
What's my purpose? solution |
The solution to the exercise is missing.
Note from the Author or Editor: The blue-lines of the solution have gone missing from this page. They are available in the print editions. They should be put back on the page.
|
Thomas Corbière |
Aug 06, 2012 |
Jun 07, 2013 |
| Safari Books Online |
67
sizeof(food) explanation |
"(‘/0’ included)" should be change to "(‘\0’ included)".
Note from the Author or Editor: In the annotation 1/3 of the way down the page change
'/0' included
to
'\0' included
|
Thomas Corbière |
Aug 06, 2012 |
Jun 07, 2013 |
| Safari Books Online |
32
The Polite Guide to Standards |
The option to compile to the C99 standard is -std=c99 not -std=99.
Note from the Author or Editor: In "The Polite Guide to Standards" change "-std=99" to "-std=c99"
|
Thomas Corbière |
Aug 05, 2012 |
Jun 07, 2013 |
| Printed |
Page 454
United States |
error handling function is diediedie(), but catch_signal() is called in main() with handle_interrupt, which does not exist.
Note from the Author or Editor: Replace handle_interrupt throughout this page with diediedie
|
Yitzchak Schaffer |
Jul 10, 2012 |
Jun 07, 2013 |
| PDF |
Page 37
while condition of Exercise Solution |
The first time through the while loop the condition "card_name[0] != 'X'" is reading uninitialized memory, it could find any value there including 'X' (terminating the program before any input is accepted).
Note from the Author or Editor: The bug is in the exercise on page 35/37.
The:
while(card_name[0] != 'X') {
...
printf("Current count: %i\n", count);
}
needs to be switched to a do/while loop:
do {
...
printf("Current count: %i\n", count);
} while(card_name[0] != 'X');
|
Patrick Lahey |
Jul 09, 2012 |
Jun 07, 2013 |
| PDF |
Page 94
Middle of page |
The sample code for the jukebox application uses the "fgets" function to get the user's search string. However, fgets will add the newline (\n) character to the end of the string when the user presses the enter key to submit their search string. This newline character must be removed and replaced with the null character (\0) in order for it to actually match one of the song titles in the tracks[] array. Without replacing the newline character, the code as listed on this page does not work (however, the screenshot on the next page shows it functioning properly).
An example fix can be used directly after the following line:
fgets(search_for, 80, stdin);
// FIX TO REPLACE NEWLINE CHARACTER
if(search_for[strlen(search_for) - 1] == '\n') {
search_for[strlen(search_for) - 1] = '\0';
}
Note from the Author or Editor: In the code on pages 91/93/94, each time the fgets() function is called, add the following line of code after it:
search_for[strlen(search_for) - 1] = '\0';
|
Matthew Wilson |
Jun 27, 2012 |
Jun 07, 2013 |
| PDF |
Page 374
3rd paragraph |
The point and purpose of the "Do this!" instruction regarding the -fPIC flag is nonobvious. Why should I "Do this!"? What am I looking for? The accompanying "Geek bits" blurb suggests it doesn't matter, just pass the compiler flag for portability.
Note from the Author or Editor: Remove the "Do This!" from the page.
|
Barend Garvelink |
May 19, 2012 |
Jun 07, 2013 |
| PDF |
Page 285
anywhere |
Pages 285 and 286 introduce the strdup() function, but neglect to mention it's declared in string.h. GCC will complain about the implicit declaration and still compile a working executable, other compilers may not be so forgiving. The text should mention which header to include.
Note from the Author or Editor: This is mentioned on page 285, first paragraph, last sentence. To make it clearer, change the font of string.h to courier new.
|
Barend Garvelink |
May 14, 2012 |
|
| PDF |
Page 218
First code sample |
Inside the function label(...) there is a call to printf(). In this call, the "age" and "teeth" parameters are passed in reverse order from how they show up in the format string.
Note from the Author or Editor: In the middle of the page, the final line of code inside void label(...) should say
name, species, age, teeth);
|
B. Garvelink |
May 06, 2012 |
Jun 07, 2013 |