cfunc.send

C Function/C Functions, Releases: AP 6.1

Pick/BASIC 'send' functionality from C.

Syntax

int _CP_send(int type, CPSTR* string, int port.number)

Description

equivalent to the Pick/BASIC statement: send{x} string{:} to port.number

The type parameter is a bit mask that may be used to set various options that must or'ed together:

_CP_SEND_X requests the 'sendx' form of send.
_CP_SEND_N suppresses the new-line
_CP_SEND_ELSE indicates an else condition

This function returns -1 if an error occurs. The error code is contained in _CP_errno.

Example

/* The following example sends 'hi' to port 1. */

CPSTR * s = _CP_mkstr('dev-att 1');
CPSTR * t = _CP_mkstr('hi');
CPSTR * c = _CP_str_null;
CPSTR * r = _CP_str_null;

_CP_execute(_CP_EXECUTE_C,s,&c,&r);
_CP_send(0, t, 1);

See Also

Command Name Type Description
cfunc.introduction Introductory Overview

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.