First working prototype of sprintf. Need to check edge cases.