_CP_send is equivalent to the send{x} string{:} to port.number BASIC statement.
int _CP_send(int type, CPSTR* string, int port.number)
The type parameter is a bit mask to set various options that can be the combination of a logical or operation:
_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.
/* 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);