Email:   


Home
In This Issue
Email a Friend
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.


PROGRAMMING POWER
Hello World!
By Alan Jay Weiner

Note on program listings
PalmPower is still a growing journal. And as such, it occasionally has growing pains. In this case, the growing pains relate to how it displays program code in your Web browser. PalmPower is created using a powerful and complex Journal Production System that performs all of the HTML code generation (including creating back issue lists, tables of contents, and even paginating articles). Unfortunately, raw C code apparently confuses the current version of the Journal Production System. Rather than leaving you without Alan's excellent code examples, we will simply be including links to individual, separate HTML pages containing the code. It's not as pretty as we would normally like, but it will get the job done until we can get the production software trained on the intricacies of C code. -- DG

In The C Programming Language by Brian Kernighan and Dennis Ritchie, their first example of a C program is the now-traditional "hello, world" program. This four-line program simply prints the words "hello, world" and exits. K&R wrote it like this (see http://www.component-net.com/pp-extras/helloworld1.html).

Alas, life is not so simple any more - the classic "hello, world" program is quite a bit more complex when we code it for the PalmPilot.

PalmPilot applications generally don't start and run to completion without yielding control to the Palm OS operating system. Applications that fail to yield control prevent other things from working. For example, the user can't switch to other applications, power down, or do a "find." Most applications will start, display a screen, and then yield until they're told to do something. Usually the user will press a button, select a menu option, or some outside event will cause the program to do something. Such programs are "event driven". They do a little work each time some particular event occurs.

For example, when the built-in Address Book starts, it does some initialization, reads the first few data records, and displays a screen. It then pauses, handing control back to Palm OS until the user does something - perhaps pressing the "new" button. The button press is an event. The program then scurries off to do a bit of work before returning to the OS to wait for the next event.

This month, we'll look at an appallingly complex "hello, world" application for the PalmPilot. Step by step, we'll examine how this "simple" application works, walking through application start, exit, and the various events it receives and processes during operation.





[ Next ]

-- Advertisement --

NO HASSLE PHOTO PRINTING, SHARING, AND STORAGE -- AS LOW AS $2.54 PER MONTH
Discover an easier way to share, print and manage your photos online! Get your own online photo album site for sharing photos, as well as easy-to-use editing tools to make sure your photos look their very best. You can even order high quality prints directly from your album -- and have them delivered right to your door!

Best of all, you can also get login-free photo sharing at your personal domain name (if you have one), so your friends and family don't have to hassle with signing up or logging in just to view your pictures. It's the perfect solution for sharing, printing and storing all your favorite images!

And it's only from The Duck! Tap here to get started.

-- Advertisement --

Write for Computing Unplugged!
Share your experience and expertise with other handheld device users. There are new opportunities at ZATZ for contributing authors and editors.

Write about something you're an expert on and get your name in lights.

For Writers' Guidelines and to discuss topics, contact Staff Editor Steve Niles. This is your opportunity to shine in front of your peers, your clients, and friends.

Click for more info!

Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.