Article View: comp.sys.amiga.tech
Article #3181What's an APTR, BPTR?
From: William J. Murphy
Date: Sat, 07 Apr 1990 16:00
Date: Sat, 07 Apr 1990 16:00
42 lines
1994 bytes
1994 bytes
I was trying to play with a bit of code which would read from stdin and
then use the parallel.device to output what was read. I came across an APTR
and can't seem to find out what exactly is an APTR. For that matter, what's
a BPTR. I would have to assume that APTR = Amiga Pointer = 32bit pointer?
BPTR = BCPL pointer = long-word aligned pointer.
I want to read the data from stdin into a character buffer and be able to
point the APTR to the start of this buffer and use the data contained
therein to be output to the parallel.device.
I tried something like this:
APTR printbuffer;
char *address;
main()
{
address = (char *)AllocMem(256, MEMF_FAST);
if (address == NULL)
exit(99);
scanf("%s", address);
printbuffer = (APTR)address;
/* bunch of parallel.device code from RKM Libs and Devs example parallel.c
deleted to make this short.*/
ParallelIO->IOPar.io_Data = (APTR)printbuffer;
SendIO( ParallelIO );
}
I have tries this where I have made printbuffer = (APTR)"Let the printer type
this" instead of trying to assign/cast the pointer to the beginning of
the character buffer. It worked. But the above example with the cast
doesn't. I figure that I must not understand what an APTR is.
Thanks for any pointers, 8^)
--
Bill Murphy | Zaphod, Vell he's just zis
murphy@newton.physics.purdue.edu | guy you know.
Amiga, it's not a religion, it's a lifestyle |
Technical Details
Message-ID:
<3421@newton.physics.purdue.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!noose.ecn.purdue.edu!newton.physics.purdue.edu!murphyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!noose.ecn.purdue.edu!newton.physics.purdue.edu!murphy From: murphy@newton.physics.purdue.edu (William J. Murphy) Newsgroups: comp.sys.amiga.tech Subject: What's an APTR, BPTR? Message-ID: <3421@newton.physics.purdue.edu> Date: 7 Apr 90 16:00:09 GMT Reply-To: murphy@newton.physics.purdue.edu.UUCP (William J. Murphy) Distribution: comp.amiga.tech Organization: Purdue Univ. Physics Dept., W. Lafayette, IN Lines: 42