1 |
/************************************************* -*- mode: C -*- |
2 |
** |
3 |
** $Header: /u/gcmpack/MITgcm/pkg/embed_files/decode_files.c,v 1.1 2006/01/11 01:38:09 edhill Exp $ |
4 |
** $Name: $ |
5 |
** |
6 |
*/ |
7 |
|
8 |
/* Decode and write files */ |
9 |
|
10 |
#include "FC_NAMEMANGLE.h" |
11 |
|
12 |
#include <stdio.h> |
13 |
|
14 |
#include "EMBEDDED_FILES.h" |
15 |
|
16 |
/* NOTE: output to stdout has been removed below since it is not a |
17 |
* good idea to mix C stdio with Fortran stdio. |
18 |
*/ |
19 |
|
20 |
void FC_NAMEMANGLE(embdec) () |
21 |
{ |
22 |
FILE * fout; |
23 |
int ii, jj; |
24 |
|
25 |
for (ii=0; ii<n_flist; ii++) { |
26 |
/* printf(" decoding: \"%s\"\n", flist[ii].name); */ |
27 |
|
28 |
fout = fopen(flist[ii].name, "w"); |
29 |
if (!fout) { |
30 |
/* |
31 |
printf(" WARNING: cannot fopen() \"%s\" for writing\n", |
32 |
flist[ii].name); |
33 |
*/ |
34 |
continue; |
35 |
} |
36 |
|
37 |
for (jj=0; jj<flist[ii].ndat; jj++) { |
38 |
fprintf(fout,"%c",(unsigned char)(flist[ii].dat[jj]) ); |
39 |
} |
40 |
fclose(fout); |
41 |
} |
42 |
} |
43 |
|