c redirect stdout to string