99
Chapter 8: C Programming
PUTS
Summary:
int puts(s);
char * s; String
Description:
The puts function will write a string to the local RS232 port.
Return value:
The puts function always returns a zero.
Example:
This program will send the string “SHUTDOWN” followed by a car riage return,
and send the string “Input 11 is 96” followed by a carriage retur n to the RS232
port when input 11 is equal to 96. A carriage return is created by typing \n.
main()
{
if (input(11) == 96)
{
puts(“SHUTDOWN\n”);
puts(“Input 11 is “);
putnum(input(11));
puts(“\n”);
}
}
Your output will look like the following:
SHUTDOWN
Input 11 is 96
_ (final cursor placement)
NOTE: The PUTS function does not send data to the modem port. The PUTS function
will not accept variables or formatted data. You must use a combination of PUTS and
PUTNUM.