How to make an Android eBook App

In this page you find the utility programs I wrote as a supplement to the book. Scroll down to find the files to download.

You can also get the book from Amazon.

Note: If you are using Windows, download the files suffixed with win (i.e., dbprep_win.c, dbprep_win.zip, fixfigs_win.c, fixfigs_win.zip) instead of the original files as listed in the book. Save for the different names, they should behave in the same way as the originals, they are just tuned to work properly under Windows. You might also want to read through the following section.

For Windows Users

Making use of the utilities under Windows might be a little tricky. For one, the Unix newline character '\n' must be encoded as a combination of carriage return & line feed (known as CRLF, or "\r\n"). The bigger problem is that Linux ELF executables cannot run natively on Windows: the C sources must be recompiled to be run as Windows EXE files.

To solve the first problem, if you are moving files from GNU/Linux/UNIX to Windows, you can run

$ unix2dos filename

To convert the file 'filename' to DOS-compatible format.

For the second problem, you might consider using MinGW, a 'Minimalist GNU for Windows' as they call it. It provides the Gnu C Compiler (GCC) and other libraries and binaries essential to compile programs under Windows. You can download and install it by following the instructions on their website (follow them carefully!): http://www.mingw.org/wiki/Getting_Started.

Besides installing the default Base System (mingw32-base), you will need the pthreads library (libpthread, or as the MinGW project calls theirs: mingw32-libpthreadgc). If you have already installed MinGW beforehand, you can open the MinGW Installation Manager from the Start menu (see first figure). From there, you can select All Packages -> MinGW -> MinGW Base System from the left-hand pane. Then scroll down to find mingw32-libpthreadgc from the right-hand side pane (see second figure), click on the little box in front of it, and select Mark for Installation from the popup menu. Then open from the menu: Installation -> Apply Changes and wait for it to download and install the package(s) from the net, and you're done!.

Now you can open a terminal (open Start -> Run -> and type in cmd.exe and press Enter). From the terminal (that Black, DOS-like window), you can type:

gcc -o dbprep_win.exe dbprep_win.c

This should compile the C source file dbprep_win.c and place the executable image in dbprep_win.exe, the EXE file you can run to follow the instructions in the book. You can follow the same step above with GCC to compile fixfigs_win.c.