October 30, 2025, 07:08:30 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


End of line characters

Started by JoaoAfonso, February 26, 2008, 03:16:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoaoAfonso

Ahoy. I am finding it amuzing writing this post in a bar using my PDA:> But this doubt arised and I'm affraid to forget it.

In other foruns I was speaking about a net program figuring out an EOF of a client connecting to it and sending info. I was told I should check all the usual different clients EOF, such as telnet. I was told I should check  \r, \n, \r\n, \n\r and \0 (different clients EOL markers). Figured out how to represent this in EB: \r and \n are for chr$(13) and chr$(10), meaning ENTER or new line. How to represent in EB, though, \0? Is there any EOF marker I am missing?

Thanks in advance
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

billhsln

Normally in most TEXT type files (not Binary's), the EOF char is Chr$(27), Control Z.

Bill
When all else fails, get a bigger hammer.

JoaoAfonso

nodnod, remembered the copy con command, to create bat files, which ending was the control Z (am I wrong?).
Thanks for the tip. Is there any other EOL I should be aware of? The /0 would be what?
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

billhsln

If I remember right /0 is a C convention to tell you when you have gotten to the end of a string.  Which is why ISTRING must be 1 longer then the maximum length you expect it to be (it has to have a /0 at the end).  I am not sure, but I think STRING ends the same way, but STRING has a max of 256 chars.

Bill
When all else fails, get a bigger hammer.

Ionic Wind Support Team

NULL is never used as an end of line marker in any text format I am aware of.  Unless it's a very old format from before my time.

You can directly use newlines in Emergence with the escape \n

"line one\nline two"

Paul.
Ionic Wind Support Team

JoaoAfonso

Hey.
Just checked and really works with \n. Anyway, what I need is try to identify the EOL of multiple clients so everyone can connect. Using instr to find chr$(10), chr$(13), chr$(27) or even "\n" is easy. I believe it might cover everything, but already dunno about a \0. This means NULL character? If yes, Paul already answered me. Can't remember about other EOL?
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

barry

The End of line character depends on the OS and to some extent on the language you're using.  Unix/Linux systems use /n.  Microsoft's systems (Windows and DOS) use /n/r.  A lot of languages, C and Ebasic among them, convert the /n/r to a /n to keep programming simpler.  That's one of the reasons you tell the compiler you're dealing with a text file.

This began with teletypes which used a /n/r, /n telling the teletype to go to the next line and /r telling it to go to the beginning of the line.  Both were needed.  Unix simplified this since in a screen or printer they would always be used together anyway.  DOS grew out of CP/M which used the telletype method intact and Windows followed suit.

I began programming in the days before computers had screens and the console was a teletype.  That was close to 50 years ago so I could remember some of it wrong. :)

Printers in those days were controlled with paper tape bands that had holes punched in columns and the programmer could send a code telling it to go to the position of the hole in a certain column.  The computer's operator had instructions about which tape band to use for any given printout.

Barry

LarryMc

Quote from: barry on February 27, 2008, 08:27:34 AM
....console was a teletype...
.. controlled with paper tape bands that had holes punched in columns.

I still have one of those old teletype machines that worked like that in a storage shed.
the 1st conputer I ever wirewrapped together used that as the output device.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

JoaoAfonso

QuoteThe End of line character depends on the OS and to some extent on the language you're using.

That is the point of trying to work with all different kinds of EOL. Anyone should be able to connect to my program, using Windows, Linux or whatever.
Concerning programming, and to try to define the commands someone is sending to my program, I should use "instr" in search for all those EOL types. Then I use left$(command line,instr figured out before). Finally I could understand how that worked... some clients end with \n\r, others with \r\n, others with just \n... Just implemented the chr$(27), and I keep trying to check if there are more.
Thanks for all tips
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900