Question : How to write a line to a text file without a chr(13) & chr(10)

Let me start with some background first. I am trying to do a bulk iinsert in SQL of a text file. Sometimes the text file contains a line feed at the end of the last line of data. This causes the SQL Bulk Insert to crash.

In another thread, http://www.experts-exchange.com/Programming/Languages/Q_23887378.html, I was shown how to read and write the last line. It works fine but the write method shown appends a Line return to the last line.

This is the opposite that I want.

I would like to read the last line and if it ends in a Chr(13)-Chr(10) or just a Chr(13) or just a Chr(10), I need to strip off the Chr(13) and/or the Chr(10).

These files contain a lot of lines, ~210,000. The above method reads and writes lines very quickly. But as I said it appends a line feed to the last line which I need to remove.

Any ideas how to do this?

Thanks,
pat

Answer : How to write a line to a text file without a chr(13) & chr(10)

I would say that the problem with your current code, if you don't want to change the PHP as blueghozt suggested, is that you are assigning

var gallery = $('#thumbs').galleriffic(...)

once the page has loaded, not once the <li>s are returned by your ajax call.

Instead of putting this code in $(document).ready, try putting it at the end of your getImages() function.
Random Solutions  
 
programming4us programming4us