Writenum

Download (14kb)
Source: svn co http://svn.jamsoftonline.com/writenum Writenum

Writenum is the resulting solution to a programming task that I was given as part of a job application. This solution is written in standard C and is completely cross platform.

The zip download contains compiled binaries for OS X, Linux and Windows. To compile the code yourself, check out the source from SVN and use GCC and the following options: gcc -std=c99 -o writenum main.c
Or if you’re on Mac OS X you can use the supplied Xcode project.

The brief was to write a program that took a integer as an argument and have the program print out the textual representation of that number. It had to support positive and negative integers within a 32 bit range.

As previously said, it’s a command line program, and it’s easy to use. Just cd into its directory and type ./writenum 1234 where 1234 is the number you wish to have converted to text.

To ‘install’ the program system wide, you can either copy it into a directory that is in your path or more preferably place a symlink to it in a directory that is in your path. Eg: sudo ln -s writenum /usr/local/bin/writenum

That will place a symlink to the writenum program that you can use regardless of what directory you’re currently in.

On Windows you’ll need to copy the program into something like C:\Windows\System32 or something… Windows just makes this illogical ;)