|
par...
perror
#include <stdio.h>
void perror (
const char *prefix
);
|
server
|
The perror function maps the value in the global variable errno into a textual message, which is printed on the standard error stream stderr. If prefix is not a null pointer, perror first prints the string pointed to by prefix followed by a colon and a space. Regardless of the value of prefix, perror next prints a message corresponding to errno followed by a newline character.
The error messages produced by perror are the same as those that can be obtained by calling the function strerror with errno as argument.
For example, if the current value of errno is EDOM, a call such as perror("myprog") might produce the following output:
myprog: domain error
|
|
PORT_BINDING
#include <chan.h>
int PORT_BINDING (
CHAN ch
);
|
stand-alone
|
|
This macro takes a CHAN object from a tasks's input or output ports and returns the integer value bound to it by a configuration BIND statement.
The result of the macro is undefined if the channel has not been bound to an integer value.
#include <chan.h>
INPUT_PORT(0, MyInput)
main(int argc, char *argv[], char *envp[],
CHAN *in_ports[], int ins,
CHAN *out_ports[], int outs) {
int V1 = PORT_BINDING(MyInput);
int V2 = PORT_BINDING(*out_ports[1]);
|
|
pow
#include <math.h>
double pow (
double x,
double y
);
|
stand-alone
|
pow returns xy, the value of x raised to the power of y.
If x is negative and y is not an integral number, pow returns HUGE_VAL and sets errno to the value of EDOM. If x is zero, and y is zero or negative, pow returns HUGE_VAL and sets errno to EDOM. If the result of the function is too large, pow returns HUGE_VAL and sets errno to the value of ERANGE.
Common error: If you forget to include math.h, the compiler automatically declares a function returning int and will give unpredictable results.
|
|
printf
#include <stdio.h>
int printf (
const char *format,
...
);
|
server
|
stack: 416 bytes
|
printf writes output to the standard output stream, stdout. It returns the number of characters that have been output, or a negative value if an output error occurred.
The arguments of printf have the same meaning as the fprintf arguments of the same name. See the description of fprintf.
A call to printf is equivalent to a call to fprintf as follows:
fprintf(stdout, format, ...);
You can use printf for debugging non-root nodes.
|
|
proc_id
#include <application.h>
const char *proc_id(void);
|
stand-alone
|
proc_id returns a pointer to a constant string that is the name used in the configuration file for the processor running the code.
|
|
prompt
#include <stdio.h>
void prompt (
const char *string
);
|
server
|
prompt sets a new value for the string that is used to identify requests for input from stdin. When using the windows server, such input requests bring up a dialog; prompt changes the text used in the title of that dialog. The setting is used for subsequent input requests until changed by another call to prompt. The maximum length of the string is 63 characters.
|
|
ptrdiff_t
#include <stddef.h>
|
stand-alone
|
The type of the result of subtracting one pointer from another.
|
|
putc
#include <stdio.h>
int putc (
int cval,
FILE *stream
);
|
server
|
putc appends the character cval to the specified output stream. It returns the character written.
EOF is returned on error.
Because it is implemented as a macro, putc treats a stream argument with side-effects improperly. In particular, the following example causes the pointer f to be incremented several times, which is unlikely to be intended:
putc(c, *f++); // DON'T DO THIS
|
|
putchar
#include <stdio.h>
int putchar (
int cval
);
|
server
|
putchar(cval) is a macro defined as putc (cval,stdout). The character cval is written to the standard output stream, stdout (normally the screen).
EOF is returned on error.
|
|
puts
#include <stdio.h>
int puts (
const char *pstr
);
|
server
|
puts copies the NUL-terminated string pstr to the standard output stream stdout and appends a newline character. The terminating NUL character is not copied.
puts appends a newline to the output string but fputs does not.
|
|
|