Article View: comp.sys.amiga.tech
Article #14098Re: Manx SDB bug (second try)
From: Andy Heffernan
Date: Thu, 08 Mar 1990 04:12
Date: Thu, 08 Mar 1990 04:12
31 lines
1814 bytes
1814 bytes
In article <34700001@suna8> martin@suna8.cs.uiuc.edu writes: [...] > >P.S. I found what appears to be a bug in Rob Peck's book "Programmer's > Guide to the Amiga". On page 17, he has a sample program that opens > the console and writes 'hello world' using a FileHandle, and fprintf(). > Naively, I tried it and got a requester. Intuitively, it shouldn't > work anyway, since fprintf() needs a (FILE *), and the pointer is a > (FileHandle *). Anyway, just thought you'd like to know... I don't have Rob's book, but it sounds like he's using the fprintf() from amiga.lib (not lc.lib) which understands AmigaDOS file handles. Try linking with just amiga.lib, omitting whatever c-lib comes with your compiler. With Lattice version 5, something like this seems to work for me: 1> lc -v -b0 hello.c 1> blink lib:astartup.obj,hello.o to hello lib lib:amiga.lib Of course, Open() returns a BPTR to a struct FileHandle, not a machine pointer, so using it as or casting to a struct FileHandle is somewhat pointless without BADDR()'ing the returned value from Open() and only if you really want to goop around with FileHandle internals. But what do I know. -- ------------------------------------------------------------------------- Andy Heffernan uunet!glyph!ahh "In a daze, Buck clutched at his head. 'Oh, how manly I feel,' he moaned."
Technical Details
Message-ID:
<505@glyph.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!glyph!ahhReferences:
<16480@well.sf.ca.us> <34700001@suna8>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!glyph!ahh From: ahh@glyph.UUCP (Andy Heffernan) Newsgroups: comp.sys.amiga.tech Subject: Re: Manx SDB bug (second try) Message-ID: <505@glyph.UUCP> Date: 8 Mar 90 04:12:27 GMT References: <16480@well.sf.ca.us> <34700001@suna8> Reply-To: ahh@glyph.UUCP (Andy Heffernan) Organization: Cinnamon Toast Crunch Research Labs Lines: 31