i'll try to answer...
you declare
your accessing:Code:char nam[10];
the last value for your array is in nam[9].Code:a_file << nam[10];
EDIT: stand corrected. Dave's answer is the correct. i didn't see that...
sorry i'm really not good at explaining.. hope this helps