strange situation in file

Hi All,

I am writing some data's into a file from C++ program. The files which i am writing is of fixed length . say 232 in length per line.
I am writing as . my c code is as

sprintf(szData,"%-12s%-30s%.4d%-30s",m_UpcCode.data(),m_UpcDescription.data(),m_nModuleNumber,m_ModuleDescription.data());
sprintf(szData1,"%.6d%-30s%-6s%-30s%-3s",m_nBrandCode,m_BrandDescription30.data(),m_SizeCode.data(),m_SizeValue.data(),m_MultiValue.data());
sprintf(szData2,"%-6s%-30s%-1s%-4s",m_FlavorCode.data(),m_FlavorDescription.data(),m_Blank.data(),m_ProductGroupCode.data());
sprintf(szData3,"%.4d%.4d%-8s%-6s%-6s%-6s%-6s",m_nTgmModuleNumber,m_nTgmProductGroupCode,m_OldestSalesDate.data(),m_ContrCharCode.data(),m_GenreCharCode.data(),m_VdfmtCharCode.data(),m_TypeCharCode.data());
sprintf(szSharpUpcData,"%s%s%s%s",szData,szData1,szData2,szData3);
pRdhFileApp->writeData(szSharpUpcData);

But after the file operation finished when i cheked the file the file is not in
fixed line length there are some junk character after the new line ("\n")
i mean that some lines are with 232 in length and some are with 233 in length . When i tried convert the line into HEXA decimamal value it is showing a apecial charater 00.

Why that is happening . PLease let me know

Thanks,
Arun