home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat España 21
/
macformat_21.iso
/
Shareware
/
Programación
/
VideoToolbox
/
VideoToolboxSources
/
ffprintf.c
< prev
next >
Wrap
Text File
|
1995-07-19
|
1KB
|
46 lines
/*
ffprintf.c
ffprintf(o,format,...);
Uses fprintf to print to two output streams, o[0] and o[1], usually stdout and a file.
Any NULL stream is ignored.
It also saves and restores the port and GDevice.
Copyright (c) 1990 Denis G. Pelli
HISTORY:
9/14/90 dgp wrote it, based on my UserPrintf(), which it replaces
8/27/92 dgp check for 8-bit quickdraw before using GDevices.
7/19/95 dgp made compatible with Standard C.
*/
#include "VideoToolbox.h"
#include <stdarg.h> /* for variable-number-of-argument macros */
int ffprintf(FILE *stream[2],char *format,...)
{
va_list args;
int i,j;
#if MAC_C
GDHandle oldDevice;
long qD=0;
#endif
#if MAC_C
Gestalt(gestaltQuickdrawVersion,&qD);
if(qD>=gestalt8BitQD){
oldDevice = GetGDevice();
SetGDevice(GetMainDevice());
}
#endif
/* print copies to all non-NULL streams in stream[] */
for(i=0;i<2; i++){
va_start(args, format);
if(stream[i] != NULL) j=vfprintf(stream[i],format,args);
}
va_end(args);
#if MAC_C
if(qD>=gestalt8BitQD)SetGDevice(oldDevice);
#endif
return j;
}