Perhaps it would be usefull if you stated what language/environment you were looking to do this in.