Hello,
I'm writing data to a text file using hte Fput Append Text command. When the last string is written the file has a blank line at the end. I there an easy way to delete this blank line?
thanks
Are you adding any carriage returns or linefeeds to the string before you write it? If so, you will not want to do so since using the TEXT flag with fputs automatically adds carriage returns and linefeeds when writing to a file, so that may explain the extra blank line.
OK, the best way to work around this is to not open the text file with the TEXT flag to keep the fputs command from automatically writing a carriage return and linefeed after each string. This is what is causing the blank line at the end. What you will need to instead is add:
fwrite 0 "`r`n" 2
prior to each fputs command you have now so that a carriage return and linefeed are added manually so the new string is on its own line.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.