should be a stupid question ...

I’ve spent hours looking for an answer to what should be a stupid question.

writing to a text file using the binary stream … how do I insert an end of line, line feed, new line, whatever we want to call it?

endofline doesn’t work
"
" doesn’t work

First, why are you not using a TextOutputStream to write a text file instead of a BinaryStream?

Second, what do you mean by “doesn’t work”? What is actually written to the file?

And what specific code are you using to do it?

Your reference to "
" leads me to believe you’re on a Mac. EndOfLine now defaults to EndOfLine.Unix, which is chr(10). Try using EndOfLine.Macintosh (chr(13)). Or, switch to TextOutputStream and use WriteLIne.

I couldn’t figure out the output stream. I followed the examples in the language reference, but I kept getting compile errors.

I’m trying to write to a second kinda error log because the timing in my app seems all screwed up. I want to know where in the sequence my errors are occurring.

I tried to find a way to write to the javascript error dialog, but couldn’t, so I’m writing to a secondary file.

when I use "
" I get “comp created

2013-11-20 13:40:34 : 63.224.89.93” Just copied it into this editor and it worked, but in the text file, I get the characters instead of a line feed.

Right, you’d have to write EndOfLine.UNIX, so your code might look like this:

bs.Write "comp created"
bs.Write EndOfLine.UNIX
bs.Write EndOfLine.UNIX
bs.Write dateString

As others have pointed out, using a TextOutputStream and WriteLine is easier.

dim cr as int8 = &h0d dim lf as int8 = &h0a dim writestream as BinaryStream writestream.WriteInt8(cr) // Don't on unix. writestream.WriteInt8(lf) // Unix or DOS.

I chose Int8 which is a signed 8 bit integer… 7 bit ASCII. :wink:

thanks guys, but still not working. Got the textOutputStream to work, but still can’t get linefeeds. If I open the text file in Word it’s fine, so that’s good enough for now.

I need to get my timing issues fixed.

Some editors will understand end of line from other platforms

BBEdit on OS X will read EndOfLine.Macinotsh, EndofLine.Unix & EndOfLine.Windows all as the same & automatically translate them - or you can tell it not to.

Other editors may not - I think Wordpad will but notepad won’t (maybe I have that backwards)

that is correct.

TextMate on Mac reads any EOL and keeps them as the same type unless you tell it to convert to MAC EOL.

thanks … it’s really a problem with notepad. Damn Microsoft.

NotePad++ is a great free alternative.

Try word pad

and if you want a really great Programmers Editor… try UltraEdit (available for WIN and OSX).
it is not free… but I love it.

Note : I don’t work for IDM software… just a fan… :slight_smile: