File:  [Public] / libwww / Library / src / HTFWrite.html
Revision 2.20: download - view: text, annotated - select for diffs
Sat Jun 1 17:46:47 1996 UTC (28 years ago) by frystyk
Branches: MAIN
CVS tags: Release-5-0a, Release-5-0, Release-4-1b5, Release-4-1b4, Release-4-1b3, Release-4-1b1, PIPELINE1, HEAD
updated docs

<HTML>
<HEAD>
  <!-- Changed by: Henrik Frystyk Nielsen, 19-May-1996 -->
  <TITLE>W3C Reference Library libwww ANSI C File Streams</TITLE>
</HEAD>
<BODY>
<H1>
  ANSI C File Streams
</H1>
<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
This module contains a set of basic file writer streams that are used to
dump data objects to disk at various places within the Library core. Most
notably, we use these streams in the <A HREF="HTFWrite.html">Format Manager</A>
in order to handle external presenters, for example post script viewers etc.
These streams can of course also be used in other contexts by the application.
<P>
<UL>
  <LI>
    <A HREF="#write">An ANSI C File Writer Stream</A>
  <LI>
    <A HREF="#converters">Various Converters using the File Writer Stream</A>
</UL>
<P>
This module is implemented by <A HREF="HTFWrite.c">HTFWrite.c</A>, and it
is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/">W3C Reference
Library</A>.
<PRE>
#ifndef HTFWRITE_H
#define HTFWRITE_H

#include "HTStream.h"
#include "HTFormat.h"
</PRE>
<H2>
  <A NAME="write">ANSI C File Writer Stream</A>
</H2>
<P>
This function puts up a new stream given an <I>open</I> file descripter.
If the file is <I>not</I> to be closed afterwards, then set
<CODE>leave_open=NO</CODE>.
<PRE>
extern HTStream * HTFWriter_new	(HTRequest * request,
				 FILE * fp,
				 BOOL leave_open);
</PRE>
<H2>
  <A NAME="converters">Various Converters using the File Writer Stream</A>
</H2>
<P>
This is a set of functions that can be registered as converters. They all
use the basic ANSI C file writer stream for writing out to the local file
system.
<PRE>
extern HTConverter HTSaveAndExecute, HTSaveLocally, HTSaveAndCallback;
</PRE>
<P>
<DL>
  <DT>
    <CODE>HTSaveLocally</CODE>
  <DD>
    Saves a file to local disk. This can for example be used to dump date objects
    of unknown media types to local disk. The stream prompts for a file name
    for the temporary file.
  <DT>
    <CODE>HTSaveAndExecute</CODE>
  <DD>
    Creates temporary file, writes to it and then executes system command (maybe
    an external viewer) when <CODE>EOF</CODE> has been reached. The stream finds
    a suitable name of the temporary file which preserves the suffix. This way,
    the system command can find out the file type from the name of the temporary
    file name.
  <DT>
    <CODE>HTSaveAndCallback</CODE>
  <DD>
    This stream works exactly like the <CODE>HTSaveAndExecute</CODE> stream but
    in addition when <CODE>EOF</CODE> has been reached, it checks whether a callback
    function has been associated with the request object in which case, this
    callback is being called. This can be use by the application to do some
    processing <EM>after</EM> the system command has terminated. The callback
    function is called with the file name of the temporary file as parameter.
</DL>
<PRE>
#endif
</PRE>
<P>
  <HR>
<ADDRESS>
  @(#) $Id: HTFWrite.html,v 2.20 1996/06/01 17:46:47 frystyk Exp $
</ADDRESS>
</BODY></HTML>

Webmaster