From: | |
Date: | 21 Feb 2001 at 15:27:39 |
Subject: | Re: Amiga types and strings |
Hi Joris
> the proto for it is: char* getFilename(char* title, char* location)
[...]
> In want to use them in the part where i init my asl struct, it looks like
> this:
> if (fr = (struct FileRequester *)
> AllocAslRequest(ASL_FileRequest,
> ASLFR_TitleText, title,
> I first tried it this way, but StormC gave an error: title is an illegal
> argument. So i did some sniffing in the includes and found out that the two
[...]
> So i tried it with a cast--> ASLFR_TitleText, (STRPTR) title, but no
> effort. I don't know what to do now... isn't there a place on the Dev2.1 CD
The reason you are getting errors is because you are trying to put char * or
STRPTR into a taglist; all items in a taglist are ULONG's, so your cast would
need to be "(ULONG) title".
> where i can read about all these types and how to handle with them correctly....
Hmm, there aren't too many Amiga specific types are there? Not that much more
than ANSI-C, and it's unlikely you'll need to use them all anyway.
The numeric types are basically just so you have a single type you can use for
making variables a specific number of bits (BYTE = 8 bit numeric, WORD = 16 bit
numeric, LONG = 32 bit numeric). A "U" in front of the numeric type means it is
unsigned.
The pointer types are similarly straightforward for normal use. APTR is a void
pointer to memory (i.e. a non-specific type pointer), BPTR and BSTR are BCPL
type pointers; the former is a general pointer and the latter is a BCPL string
pointer (used by AmigaDOS) and STRPTR is a pointer to a null terminated string
(as most strings will be).
Since APTR's are of void type, you cannot do any math with them, or access
memory at that pointer. You need to cast them to a specific type first.
Any other pointers are likely to be pointers to specific OS types, such as
struct Window *, struct Screen *, etc. If you are working mostly with OS
functions, the choice of type will pretty much will already be made for you. If
you are going to use these types for your own routines, just choose whatever is
most appropriate (thinking about upper limits of numbers you will need to
store, etc, what contents of memory pointed to will be).
------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://us.click.yahoo.com/kWP7PD/pYNCAA/4ihDAA/d8AVlB/TM
---------------------------------------------------------------------_->
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/