basic.%fputc

C Function/BASIC Program, Releases: AP/Unix

Puts a character on a stream.

Syntax

variable=%fputc(character, (char*)stream)

Description

writes the character specified by 'character' on the named output 'stream'.

Note: The character is passed as a number. Normal usage would override the type (see example below). The Unix 'putc()' and 'putchar()' cannot be used because they are macros, rather than functions.

If successful, the character is returned as a number, else EOF (-1) is returned.

If the character is contained in a Pick/BASIC dynamic array, an explicit (char) type override must be used, otherwise a pointer would be passed to the C function.

Example

c='a'
n=%fputc( (char)c, (char*)strm )

See Also

Command Name Type Description
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.cfunction Definition Declare a list of C functions.
basic.%fopen C Function Opens a stream.
basic.%fclose C Function Closes stream.
basic.%fprintf C Function Writes formatted string on a stream.
basic.%fputs C Function Writes a string on a stream.

User Comments

What do you think?

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

Login to leave your comments.