Annotation of libwww/Library/src/HTFWrite.html, revision 2.18

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.17      frystyk     3: <TITLE>W3C Reference Library libwww ANSI C FILE STREAM</TITLE>
2.18    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.1       frystyk     5: <NEXTID N="z4">
                      6: </HEAD>
                      7: <BODY>
                      8: 
2.8       frystyk     9: <H1>Wrting to a File using ANSI C</H1>
2.1       frystyk    10: 
                     11: <PRE>
                     12: /*
2.4       frystyk    13: **     (c) COPYRIGHT MIT 1995.
2.1       frystyk    14: **     Please first read the full copyright statement in the file COPYRIGH.
                     15: */
                     16: </PRE>
                     17: 
                     18: It is useful to have both FWriter and Writer for environments in which
2.2       frystyk    19: <CODE>fdopen()</CODE> doesn't exist for example. The module contains
                     20: the following parts:
                     21: 
                     22: <UL>
2.15      frystyk    23: <LI><A HREF="#utils">Basic Utility Streams</A>
                     24: <LI><A HREF="#write">An ANSI C File Writer Stream</A>
                     25: <LI><A HREF="#converters">Various Converters using the File Writer Stream</A>
2.2       frystyk    26: </UL>
                     27: 
2.1       frystyk    28: 
2.15      frystyk    29: This module is implemented by <A HREF="HTFWrite.c">HTFWrite.c</A>, and
                     30: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     31: Reference Library</A>.
2.1       frystyk    32: 
                     33: 
                     34: <PRE>
                     35: #ifndef HTFWRITE_H
                     36: #define HTFWRITE_H
                     37: 
                     38: #include "HTStream.h"
                     39: #include "HTFormat.h"
                     40: </PRE>
                     41: 
2.15      frystyk    42: <H2><A NAME="write">An ANSI C File Writer Stream</A></H2>
                     43: 
                     44: This function puts up a new stream given an open file descripter. If the file
                     45: is not to be closed afterwards, then set leave_open = NO.
                     46: 
                     47: <PRE>
                     48: extern HTStream * HTFWriter_new        (HTRequest * request,
                     49:                                 FILE * fp,
                     50:                                 BOOL leave_open);
                     51: </PRE>
                     52: 
                     53: <A NAME="converters"><H2>Various Converters using the File Writer
                     54: Stream</H2></A>
                     55: 
                     56: This is a set of functions that can be registered as converters. They
                     57: all use the basic ANSI C file writer stream for writing out to the
                     58: local file system.
2.1       frystyk    59: 
2.5       frystyk    60: <PRE>
2.14      frystyk    61: extern HTConverter HTSaveAndExecute, HTSaveLocally, HTSaveAndCallback;
2.1       frystyk    62: </PRE>
                     63: 
2.15      frystyk    64: <DL>
2.1       frystyk    65: 
2.15      frystyk    66: <DT><CODE>HTSaveLocally</CODE>
                     67: <DD>Saves a file to local disk. This can for example be used to dump
                     68: date objects of unknown media types to local disk. The stream prompts
                     69: for a file name for the temporary file.
                     70: 
                     71: <DT><CODE>HTSaveAndExecute</CODE>
                     72: 
                     73: <DD>Creates temporary file, writes to it and then executes system
                     74: command (maybe an external viewer) when EOF has been reached. The
                     75: stream finds a suitable name of the temporary file which preserves the
                     76: suffix. This way, the system command can find out the file type from
                     77: the name of the temporary file name.
                     78: 
                     79: <DT><CODE>HTSaveAndCallback</CODE>
                     80: 
                     81: <DD>This stream works exactly like the <CODE>HTSaveAndExecute</CODE>
                     82: stream but in addition when EOF has been reached, it checks whether a
                     83: callback function has been associated with the request object in which
                     84: case, this callback is being called. This can be use by the
                     85: application to do some processing <EM>after</EM> the system command
                     86: has terminated. The callback function is called with the file name of
                     87: the temporary file as parameter.
                     88: 
                     89: </DL>
                     90: 
                     91: <A NAME="tmp"><H3>Location of Temporary Files</H3></A>
                     92: 
                     93: The destination for temporary files can be managed by the following
2.2       frystyk    94: functions:
                     95: 
                     96: <PRE>
2.16      frystyk    97: extern BOOL  HTTmp_setRoot             (const char * tmp_root);
                     98: extern const char * HTTmp_getRoot      (void);
2.13      frystyk    99: extern void  HTTmp_freeRoot            (void);
2.2       frystyk   100: </PRE>
                    101: 
                    102: The <CODE>HTTmp_freeRoot</CODE> is called by the <A
2.11      frystyk   103: HREF="HTReq.html#Library">HTLibTerminate</A> function. The default
2.13      frystyk   104: value is defined in <A HREF="HTAccess.html#Addresses">HTReq.html</A>
2.1       frystyk   105: 
2.8       frystyk   106: <PRE>
2.1       frystyk   107: #endif
                    108: </PRE>
                    109: 
2.18    ! frystyk   110: <HR>
        !           111: <ADDRESS>
        !           112: @(#) $Id: Date Author State $
        !           113: </ADDRESS>
2.1       frystyk   114: </BODY>
                    115: </HTML>

Webmaster