Site Tools


documentation:development:opera:pf25:ppgfldr:smmfldr:cdmfldr:02cdm002

Programming Notes


This section discusses some frequently encountered problems. It covers:

Using Relative Pathnames

Applications should always use pathnames relative to the location from which the application boots.

For example, during development an application boots from /remote. If artwork is located in $boot/art…. , the program should refer to those files as art/…. During development, the pathname is then resolved to /remote/art since the program booted from /remote.

A title should use $boot and other aliases explicitly only in cases where an absolute path is needed because the program would not know how to resolve a relative pathname. Generally, all programs should be able to resolve a relative pathname, with the current location being the point from which the program was entered.

Warning: Never use /remote in a pathname; it won't be available on an end-user machine.

Hints on Error Checking and Other Advice

Here are some common problems and advice on how to avoid them:

<HTML><ul></HTML> <HTML><li></HTML>Check all function return values. Make sure a function never exits the program if an error results and that returned pointer values are not NULL.<HTML></li></HTML> <HTML><li></HTML><HTML><p></HTML>Use printf() to facilitate debugging. The printf() statements in your program statements are displayed in the Debugger Terminal window when you run the application in Debugger mode. The printf() statements are dropped when you run in stand-alone mode.<HTML></p></HTML> <HTML><p></HTML>Note: Once you have generated a clean cdrom.image file, eliminate the printf() statements for a slightly more efficient title.
<HTML></p></HTML><HTML></li></HTML> <HTML><li></HTML>Don't use OpenMacLink(). The function is obsolete.<HTML></li></HTML> <HTML><li></HTML>Read an integral number of blocks. When reading files from the CD-ROM, you must read an integral number of disc blocks. For example, if CMD_Status reports that the blocksize is 2048, and the file size is 3277 bytes, you must read 4096 bytes.<HTML></li></HTML> <HTML><li></HTML>Don't forget to recompile and retest. If you changed your application don't forget to recompile it and test it once more.<HTML></li></HTML><HTML></ul></HTML>

documentation/development/opera/pf25/ppgfldr/smmfldr/cdmfldr/02cdm002.txt · Last modified: 2022/10/10 16:53 by 127.0.0.1