This sounds familiar.

See http://cboard.cprogramming.com/showthread.php?t=73528.