C Bits and Bobs

Richard Heathfield

Last updated: 31 October 2003

bitpal.c - Binary palindromes

clint.c - ASCII art in C

clint.txt - Output of clint.c

clint.jpg - The source photograph from which clint.c was generated

convnum.c - An ad hoc demo that turns, say, 1034923 into one million thirty four thousand nine hundred and twenty three

dirparse.c - Traversing a Windows directory tree. Caution: Windows only!

dlldemo.zip - A really simple Windows DLL project

emgen - An error message utility

fgetdata - Routines to read an entire word or line from a text stream

foofun.c - See the comp.lang.c FAQ, Question 1.22

gcg8.c - A code generator generator generator generator generator generator generator generator generator generator!! If your compiler refuses to touch it, try the next one down...

gcg6.c - A code generator generator generator generator generator generator generator generator. If your compiler still doesn't like it, try the next one down...

gcg5.c - A code generator generator generator generator generator generator generator. If your compiler still doesn't like it, try the next one down...

gcg4.c - A code generator generator generator generator generator generator. If your compiler still doesn't like it, try getting a better compiler.

getch.c - A simple demonstration of how to get extended keycodes in an MS-DOS or Windows console application.

hello.c - A very simple demonstration of how to open a file and write some text into it, with proper error handling.

Using C libraries - A discussion of code libraries in C - why to use them, how to make them, and how to use them

msrecurse.c - A quotation from Micros~1's Visual C++ documentation, reproduced here as a classic example of - well, read it for yourself. I have not spoiled your fun by annotating it.

piglatin.c - A rather naive implementation of the Pig Latin language. Use argv for input!

primes.c - A prime number counter. This program uses the Sieve of Eratosthenes to count how many prime numbers there are in the range 1 to 1000000 (one million). It demonstrates one or two handy performance tips - not least how to store the sieve in under 64KB (so that the program will even work in MS-DOS)

proof.c - Another take on FAQ 1.22

rand.c - A simple demonstration of pseudorandom number manipulation.

safesrand.c - Lawrence Kirby's time_seed routine. Usage: srand(time_seed());

split.c - Splitting a text line into tokens

strarr.c - Simple string array management in C (from the book C Unleashed by Heathfield and Kirby)

strarr.h - Header for strarr.c

strarrdemo.c - Demonstration code for string arrays

ttt.c - A noughts and crosses game - worth a look if you're into permutation processing

Visual C++ console projects - How to create them.

Vigenère - Strictly speaking, not a Vigenère cipher. This program applies a repeated key to a plaintext using XOR.

wbods50.c - An MS-DOS implementation of John Conway's "Game of Life" using no headers, no libraries, no assembly language, no nothing - it's just raw C code.




That's it for now. Suggestions for improvements to this page are most welcome.


You are visitor number  - call again soon!