Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for March, 2012

c programming in mac os x and temporary memory


I used to program in C in my old mac os 8 environment, and it was
easy – I was very fond of temporary memory allocations outside my
application space, it being as free as using malloc on a unix box.

Can I still do that in mac os x (which I haven’t got yet – I’m up to
os 9.1 but seriously considering moving)? That is, can I still program
the full os x functionality using c only, and being able to get memory
freely? I’m
onbe of those dyed-in-wool c programmer’s, but I must admit
objective-c is

That may be two or more questions rather than just 1.

And here’s one that combines ‘em:

suppose I want to read an arbitrarily large file (but still one that
will fit in my machine’s memory) into my memory, but not confined to
my application’s (say it’s a programmer’s editor) pre-defined and
unalterable original max size?

Sorry for the vagueness. Maybe pointers to docs and some simple yes
you can
do it by using this routine….

Thanks for any help.

posted by admin in Uncategorized and have Comments (8)

OS X daemon, how to be immune to termination at logout?

I have a program built as a C++ tool within Project Builder.
I want it to run as a daemon.  So fine.  BTW, this is a user land
driver for a USB device, and uses IOKit, CoreFoundation, and Carbon.
I want it to stay alive when a user logs out.

1.  If I include a call to daemon(0,0), it works fine on 10.2, but
dies mysteriously on 10.1 shortly after it launches.

2.  If I don’t include the daemon(0,0) call, I have to put an "&" after the
program name in my startup item script, otherwise the system hangs
waiting for my program to finish (which it won’t of course).

Now my process survives across user logout on 10.2, but on 10.1
logout times out because my process can’t/won’t terminate.

So how do I make my process immune from termination at logout?

I read in some samplecode that you have to be careful what you link into
a daemon, but have found no docs on that.  Could that be the source of
my dying in (1)?

fred ross-perry

posted by admin in Uncategorized and have Comments (6)

Cocoa String Concatenation

Hi all the question is in the subject, how can i concatenate 2 string? ok i
see the init with string method,but it is abit complicated for 6 string
concatenation(for example). is there something like "+" for NSString ?


posted by admin in Uncategorized and have Comments (12)

Mac OS X 10.2.3 & URLDownload misbehaviour

I recently upgraded my Mac to 10.2.3 and now one of my
applications is misbehaving. To be precise URLDownload
often returns the error code -3264. I’ve looked everywhere
for what this might mean but to no avail. Any ideas?

posted by admin in Uncategorized and have Comments (4)

[Q] How can I include DateTimeUtils.h header file in Project Builder ?


I created "Carbon Application (Nib Based)" project in Project Builder.

I included DateTimeUtils.h header file for using GetTime function in
my source code, like this…
#include <DateTimeUtils.h>
And, when I select "DateTimeUtils.h" in "#incude <DateTimeUtils.h>"
and press "shift-command-D", DateTimeUtils.h header file was opened.

But, when I build my project, "DateTimeUtils.h:No such file or
directory" error message occurred.

I checked "CoreServices.framework" in "External Frameworks and
Libraries" in my project.

Why project builder was not found DateTimeUtils.h during build ?

How can I correctly include DateTimeUtils.h header file ?

Let me konw, please…

posted by admin in Uncategorized and have No Comments

Prefs dialog with panes for OS9?

Does anyone have any links for source code for a pref dialog with
tabs/panes that I can use on my system 8?

I couldn’t find anything on the, except for OSX.

Thanks much in advance.

What is Mind? No Matter.
What is Matter? Never Mind.

posted by admin in Uncategorized and have Comments (3)

List Manager and Carbon Events

I’d like to adjust some displayed data in my window when the selection
has changed in a List Control.

Is there an event I can listen for for when the user uses the arrow keys
to change the selection in a List Control?

I can deal with when the user uses the mouse to click on a new
selection. I receive a kEventControlHit event.

But I don’t receive one for when the user uses the arrow keys to change
the selection.


posted by admin in Uncategorized and have Comments (4)

How to set font size in TableView ?

How to set font size in TableView (for all line and all column) ?

Alain Birtz
Internet abz_ANTiSP…, abirtz_ANTiSP…
Remove _ANTiSPaM_ in the email address
Enlever _ANTiSPaM_ dans cette adresse electronique

posted by admin in Uncategorized and have Comment (1)

Help Please: Beginner C prgramming question

I am taking a "Intro to C" programming class
and cant quit get this about Octal and base 10
or base 8…..

"Two special formats in C enable constants to be expressed
in a base other than decimal (base 10 ).
If the first digit of the integer value is zero than the integer is taken
as being expressed in Octal notation, that is, in base 8……….
so to express the value Octal in C, the notation
050 is used……
Similary, the C octal constant 0177 represents the decimal
value 127 ( 1 X 64 + 7 x 8 + 7 )"

Could anyone Please help w/ this or
give any good resources.



Kevin Duggan


posted by admin in Uncategorized and have Comments (2)

Problems with repositioning controls

I’ve got a resizable window with a bunch of controls.

I’m using SetControlBounds to move the controls.
But SetControlBounds doesn’t seem to move controls embedded within the
control I want to move.

Is this the correct behaviour?

Also, after moving the controls, I invalidate the window rect so that it
redraws the controls in their new positions, however, it doesn’t erase
the areas where the controls used to be.

If I invalidate the window rect, why doesn’t it redraw the window
background also?

If I hide/unhide the window with windowshade, the old control images are


posted by admin in Uncategorized and have No Comments