Query: ns_conncopytofile
OS: debian
Section: 3aolserv
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Ns_ConnCopy(3aolserver) AOLserver Library Procedures Ns_ConnCopy(3aolserver) __________________________________________________________________________________________________________________________________________________NAMENs_ConnCopyToChannel, Ns_ConnCopyToDString, Ns_ConnCopyToFd, Ns_ConnCopyToFile - Copy request content to open file or dstringSYNOPSIS#include "ns.h" int Ns_ConnCopyToChannel(conn, ncopy, chan) int Ns_ConnCopyToDString(conn, ncopy, dsPtr) int Ns_ConnCopyToFd(conn, ncopy, fd) int Ns_ConnCopyToFile(conn, ncopy, fp)ARGUMENTSNs_Channel chan (in) Pointer to Tcl channel open for write. Ns_Conn conn (in) Pointer to open connection. Ns_DString dsPtr (in) Initialized dstring. int fd (in) File descriptor open for write. FILE fp (in) Stdio FILE pointer open for write. int ncopy (in) Number of bytes to copy. _________________________________________________________________DESCRIPTIONThese functions copy content from an open connection request to the given open file descriptor, FILE, dstring, or Tcl_Channel. The rou- tines work by copying from the content buffer; see the man page on Ns_ConnContent for how this buffer is managed for both small and large requests. The functions all return the number of bytes copied which will match the requested ncopy argument unless there is an error writing the con- tent or the requested bytes is greater than the number of bytes still available to be read. An internal offset into the connection is maintained and is shared with routines such as Ns_ConnRead which also consume content from the same buffer. Note that routines which access the entire content, e.g., Ns_ConnContent, Ns_ConnContentFd, or Ns_ConnGetQuery will continue to provide access to the entire request regardless if one of the Ns_ConnCopy or Ns_ConnRead functions have been used.EXAMPLESThe following example demonstrates copying user data to a temp file: fd = open("myfile.out", O_WRONLY|O_BINARY); len = Ns_ConnContentLength(conn); if (Ns_ConnCopyToFd(conn, len, fd) != len) { ... error writing content or content already consumed ... }SEE ALSONs_ConnRead(3), Ns_ConnReadLine(3), Ns_ConnContent(3), Ns_ConnContentFd(3)KEYWORDSconnection, content, read AOLserver 4.0 Ns_ConnCopy(3aolserver)
Similar Topics in the Unix Linux Community |
---|
ncopy doesn't work from cron |
copying content of a file |
How to copy entire file content into another file being in last line mode of vi ? |