I am getting a newline character into a text file while I was writing some content into the text file using the code below
sprintf(str,"GodownName,LorryNumber,InvoiceNumber,CementCompanyName,RcvdPrsnName,RcvdPrsNDsgnation,EntityQty,Date\0");
write(fd,str,strlen(str));
the text is writing from 2nd row and an unwanted newline is writing at 1st row. I want my text to be written from 1st row. So please any one help me to remove newline characters or spaces from text file
Thanks in advance
My guess is that you have another function which writes in
fdbefore the call of this function.Besides, writing
"\0"at the end of a string litteral is useless, there’s already one.