FUNCTIONS CORE

OsNewLine()

Return the end of line of the operating system

Syntax

Signature
OsNewLine( ) --> cEndOfLine

Arguments

None.

Return value

Chr( 13 ) + Chr( 10 ) on Windows and Chr( 10 ) on Linux.

Description

OsNewLine() returns the same value as Eol() without an argument.

Notes

Eol( cText ) also finds the end of line that a text already uses.

Example

OsNewLine.prg
PROCEDURE Main()

#if OS_WINDOWS
   Check( 'OsNewLine() on Windows           ', OsNewLine(), Chr( 13 ) + Chr( 10 ) )
#else
   Check( 'OsNewLine() on Linux             ', OsNewLine(), Chr( 10 ) )
#endif

   Check( 'OsNewLine() is Eol()             ', OsNewLine(), Eol() )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

OsNewLine() on Windows           OK
OsNewLine() is Eol()             OK

See also