1 /*$$$ SUBPROGRAM DOCUMENTATION BLOCK
4 C PRGMMR: ATOR ORG: NP12 DATE: 2005-11-29
6 C ABSTRACT: THIS ROUTINE WRITES A SPECIFIED NUMBER OF BYTES TO THE
7 C SYSTEM FILE MOST RECENTLY OPENED FOR WRITING/OUTPUT VIA BUFR
8 C ARCHIVE LIBRARY ROUTINE COBFL.
10 C PROGRAM HISTORY LOG:
11 C 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
13 C USAGE: CALL CWBMG( BMG, NMB, IRET )
14 C INPUT ARGUMENT LIST:
15 C BMG - CHARACTER*1: ARRAY CONTAINING BYTES TO BE WRITTEN
16 C NMB - INTEGER: NUMBER OF BYTES WITHIN BMG TO BE WRITTEN
18 C OUTPUT ARGUMENT LIST:
19 C IRET - INTEGER: RETURN CODE:
21 C -1 = I/O error occurred while writing
24 C THIS ROUTINE CALLS: BORT
25 C THIS ROUTINE IS CALLED BY: None
26 C Normally called only by application
31 C MACHINE: PORTABLE TO ALL PLATFORMS
37 void cwbmg( char *bmg
, f77int
*nmb
, f77int
*iret
)
42 ** Make sure that a file is open for writing.
44 if ( pbf
[1] == NULL
) {
45 sprintf( errstr
, "BUFRLIB: CWBMG - NO FILE IS OPEN FOR WRITING" );
46 bort( errstr
, ( f77int
) strlen( errstr
) );
49 ** Write the BUFR message to the file.
51 *iret
= ( ( fwrite( bmg
, 1, *nmb
, pbf
[1] ) == *nmb
) ? 0 : -1 );