---
name: "ns_adp_append"
section: "3aolserver"
platform: "linux"
package: "aolserver4-dev"
version: "4.5.1-18.1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/ns_adp_append"
---

# ns\_adp\_append(3aolserver)

ADP output commands

```

```

## NAME

ns\_adp\_append, ns\_adp\_close, ns\_adp\_dump, ns\_adp\_flush, ns\_adp\_puts, ns\_adp\_stream, ns\_adp\_tell, ns\_adp\_trunc, ns\_puts - ADP output commands

## SYNOPSIS

```
ns_adp_append string ?string ...?
ns_adp_close
ns_adp_dump
ns_adp_flush
ns_adp_puts ?-nonewline? string
ns_adp_stream
ns_adp_tell
ns_adp_trunc ?length?
ns_puts ?-nonewline? string
```

```

```

## DESCRIPTION

These commands enable adding to and manipulation of the ADP output buffer.  See **ns\_adp** for an overview on ADP pages.

- **ns\_adp\_append** *string* ?*string ...*?

  This command appends one or more strings to the ADP output buffer. For the case of a single argument, it is equivalent to **ns\_adp\_puts** **-nonewline** *string*.

- **ns\_adp\_close**

  This command can be used to flush and close the underlying HTTP connection.  ADP execution continues after the connection is closed; any text appended to the output buffer after the close is simply discarded when processing is complete.

- **ns\_adp\_dump**

  This command returns the text of the ADP buffer.

- **ns\_adp\_flush**

  This command flushes the contents of the ADP buffer to the current connection or file channel. It will raise a Tcl exception if the underlying flush failed, for example, if the HTTP connection is closed or the channel write failed.  Flushed content is returned in "chunked-encoding" format if the HTTP protocol version is at least 1.1 (normally the case for all modern browsers).  A call to **ns\_adp\_flush** is not normally needed except for specialized applications as all content is automatically flushed at the end of a connection or on buffer overflow.  (see **ns\_adp\_ctl bufsize** for details on buffer mangement).

- **ns\_adp\_puts** ?*-nonewline*? *string*

  This function appends the specified *string* to the ADP buffer.  Unless the optional *-nonewline* argument is used, a newline will be appended to the page after the string.  Note that the argument to ns\_adp\_puts is a single string unlike **ns\_adp\_append** which takes a variable number of strings to append.

- **ns\_adp\_stream**

  This function begins streaming mode for the ADP. All data currently in the ADP output buffer is flushed and any subsequent data will be output directly to the connection.  It is equivalent to an **ns\_adp\_flush** followed by an **ns\_adp\_ctl bufsize 0**.

- **ns\_adp\_tell**

  This function returns the total number of bytes current in the ADP buffer.  A buffer overflow or direct call to **ns\_adp\_flush** will reset this counter to zero so the result of **ns\_adp\_tell** may not return the total number of bytes eventually sent.

- **ns\_adp\_trunc** ?*length*?

  This function can be used to truncate output buffer to the requested size. This can be useful to trim unintended white space or to clear a result and generate an error message.  Note that content already streamed to the client, if any, cannot be truncated.

- **ns\_puts** ?*-nonewline*? *string*

  This command is a deprecated name for **ns\_adp\_puts**.

## SEE ALSO

ns\_adp(n), ns\_adp\_include(n)

## KEYWORDS

ADP, dynamic pages
