SshSetLineMode Function  
 
INT WINAPI SshSetLineMode(
  HCLIENT hClient,  
  INT nLineMode  
);

The SshSetLineMode function changes the current line mode for the client session.

Parameters

hClient
Handle to the client session.
nLineMode
An integer value which specifies how the newlines are sent by the library. It must be one of the following values:
Value Description
SSH_NEWLINE_DEFAULT There are no changes to how data is sent to the server. Any carriage return or linefeed characters that are sent using the SshWrite function will be sent as-is. The SshWriteLine function will terminate each line of text with a carriage return and linefeed (CRLF) sequence. This is the default line mode that is set when a new connection is established.
SSH_NEWLINE_CR A carriage return is used as the end-of-line character. Any data sent using the SshWrite function that contains only a linefeed (LF) character or a carriage return and linefeed (CRLF) sequence to indicate the end-of-line will be replaced by a carriage return (CR) character. The SshWriteLine function will terminate each line of text with a single carriage return character.
SSH_NEWLINE_LF A linefeed is used as the end-of-line character. Any data sent using the SshWrite function that contains only a carriage return (CR) character or a carriage return an linefeed (CRLF) sequence to indicate the end-of-line will be replaced by a linefeed (LF) character. The SshWriteLine function will terminate each line of text with a single linefeed character.
SSH_NEWLINE_CRLF A carriage return and linefeed (CRLF) character sequence is used to indicate the end-of-line. Any data sent using the SshWrite function that contains only a carriage return (CR) or linefeed (LF) will be replaced by a carriage return and linefeed. The SshWriteLine function will terminate each line of text with a carriage return and linefeed sequence.

Return Value

If the function succeeds, the return value is the previous line mode for the client session. If the function fails, the return value is SSH_ERROR. To get extended error information, call SshGetLastError.

Remarks

When a connection is initially established with the server, it determines what characters are used to indicate the end-of-line and how they are displayed. On UNIX based systems, this is controlled by the settings for the pseudo-terminal that is allocated for the client session, and can be changed using the stty command. In most cases, the client line mode can be left at the default. However, in some cases you may need to change the line mode, particularly if you intend to send data from a Windows text file or copied from the clipboard.

Windows uses a carriage return and linefeed (CRLF) sequence to indicate the end-of-line and a UNIX based server may interpret that as multiple newlines. To prevent this, use the SshSetLineMode function to change the current line mode to SSH_NEWLINE_CR and the CRLF sequence in the text will be replaced by a single carriage return.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cstshv12.lib

See Also