Welcome, Guest. Please login or register.

Author Topic: Reprint of the Amiga Guru Book  (Read 4229 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Reprint of the Amiga Guru Book
« on: April 20, 2007, 11:09:11 PM »
I've found a couple of errors from the book. :-)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Reprint of the Amiga Guru Book
« Reply #1 on: April 20, 2007, 11:42:19 PM »
I've forgot the others, but the most obvious one is the wrong documentation and example usage of dos.library/ReadLink() and ACTION_READ_LINK. The return value is not BOOL success value, but:
dp_Res1
-2 the passed buffer was too small
-1 some other error occured, dp_Res2 has more info
other: length of the string filled to buffer

And the same mapped to ReadLink(), where dp_Res2 is in IoErr(), and dp_Res1 in D0.

Thus example code of
Code: [Select]

if (ReadLink(...))
{
  /* success - do stuff */
}
else
{
  /* failed */
}

...is wrong. It should be:
Code: [Select]

if (ReadLink(...) > 0)