Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GetKeys() and KeyMap?



On 7/28/04 12:36 AM, email@hidden didst favor us with:

> In a message dated 7/27/04 6:43:39 PM, email@hidden writes:
>
>> Yo Spikeio,
>
> Yo chiltonio. :)
>
>>
>> On Jul 27, 2004, at 6:26 PM, email@hidden wrote:
>>> Bit Shifting should do the trick right?
>>
>> Absolutely.
>
> Good.
> (my problem was I was thinking Boolean not Bit)

Stop assuming so much and do some research and reading. A Boolean occupies
one byte. A KeyMap is an array of four longs = 16. How could you think 16
bytes could hold 128 1-byte Booleans?
>
>
> At the last second I remembered seeing some other bit stuff, masks,
> so I tryed using a mask (wouldn't compile),
> then I tryed using several different bit shifts (wouldn't compile)

You need to take some time to learn what you're doing. This business of just
trying stuff when you don't even understand bits and bytes and other basic
concepts is just a waste of time.

> it gave me this error:
> #Error: illegal operand types
> Had: (long *)
>
>
>
> here is the code for the BitShift:
>
> #include <Carbon.h>
> Boolean Done = false;
> KeyMap keys;
>
> main()
> {
> while (!Button() && (Done == false))
> {
> GetKeys(keys);
> Done = keys >> 24;

keys is is a long*, so you're shifting a pointer. What are you really trying
to do here?

> /* also tryed 128 - (128 - 24) and
> 104 (got: to high error) */
> /* notice 128 - (128 - 24) and 104 equal the same */

Good grief. Notice that: 128 - (128 - 24) = 24.

> Note: if the code is shown to me (like a tutorial does) I will more than
> likely see my error.

The carbon-dev list isn't a Bare Essentials of Programming list, nor is it a
Programming Tutorial list. You need to learn the basics of programming or
you'll wasted gobs of time and constantly be frustrated trying to write
software. Really, do *yourself* a favor and figure those things out.

Larry
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: GetKeys() and KeyMap? (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.