41 char *endian_ptr = (
char *)&endian;
47 strcpy(rawfname, filename);
48 strcat(rawfname,
".raw");
49 if ((fp = fopen(rawfname,
"wb")) == NULL) {
57 strcpy(infofname, filename);
58 strcat(infofname,
".info");
59 if ((fp = fopen(infofname,
"wb")) == NULL) {
63 fprintf(fp,
"filename = %s\n", rawfname);
65 fprintf(fp,
"image.header_bytes = 0\n");
66 fprintf(fp,
"image.nline = %d\n", buf.
nline);
67 fprintf(fp,
"image.nsample = %d\n", buf.
nsample);
68 fprintf(fp,
"image.datatype = %s\n", datatype[buf.
datatype]);
69 fprintf(fp,
"image.datasize = %d\n", buf.
datasize);
70 if (endian_ptr[0] == 1)
71 fprintf(fp,
"image.byteorder = little_endian\n");
73 fprintf(fp,
"image.byteorder = big_endian\n");
75 fprintf(fp,
"mapinfo.path = %d\n", mapinfo.
path);
76 fprintf(fp,
"mapinfo.start_block = %d\n", mapinfo.
start_block);
77 fprintf(fp,
"mapinfo.end_block = %d\n", mapinfo.
end_block);
78 fprintf(fp,
"mapinfo.resolution = %d\n", mapinfo.
resolution);
79 fprintf(fp,
"mapinfo.resfactor = %d\n", mapinfo.
resfactor);
80 fprintf(fp,
"mapinfo.nline = %d\n", mapinfo.
nline);
81 fprintf(fp,
"mapinfo.nsample = %d\n", mapinfo.
nsample);
82 fprintf(fp,
"mapinfo.pixelcenter = %s\n",
84 fprintf(fp,
"mapinfo.som.ulc.x = %f\n", mapinfo.
som.
ulc.
x);
85 fprintf(fp,
"mapinfo.som.ulc.y = %f\n", mapinfo.
som.
ulc.
y);
86 fprintf(fp,
"mapinfo.som.ctr.x = %f\n", mapinfo.
som.
ctr.
x);
87 fprintf(fp,
"mapinfo.som.ctr.y = %f\n", mapinfo.
som.
ctr.
y);
88 fprintf(fp,
"mapinfo.som.lrc.x = %f\n", mapinfo.
som.
lrc.
x);
89 fprintf(fp,
"mapinfo.som.lrc.y = %f\n", mapinfo.
som.
lrc.
y);
91 fprintf(fp,
"mapinfo.geo.ulc.lat = %f\n", mapinfo.
geo.
ulc.
lat);
92 fprintf(fp,
"mapinfo.geo.ulc.lon = %f\n", mapinfo.
geo.
ulc.
lon);
93 fprintf(fp,
"mapinfo.geo.urc.lat = %f\n", mapinfo.
geo.
ulc.
lat);
94 fprintf(fp,
"mapinfo.geo.urc.lon = %f\n", mapinfo.
geo.
ulc.
lon);
95 fprintf(fp,
"mapinfo.geo.ctr.lat = %f\n", mapinfo.
geo.
ctr.
lat);
96 fprintf(fp,
"mapinfo.geo.ctr.lon = %f\n", mapinfo.
geo.
ctr.
lon);
97 fprintf(fp,
"mapinfo.geo.lrc.lat = %f\n", mapinfo.
geo.
lrc.
lat);
98 fprintf(fp,
"mapinfo.geo.lrc.lon = %f\n", mapinfo.
geo.
lrc.
lon);
99 fprintf(fp,
"mapinfo.geo.llc.lat = %f\n", mapinfo.
geo.
lrc.
lat);
100 fprintf(fp,
"mapinfo.geo.llc.lon = %f\n", mapinfo.
geo.
lrc.
lon);
102 fprintf(fp,
"mapinfo.pp.path = %d\n", mapinfo.
pp.
path);
103 fprintf(fp,
"mapinfo.pp.projcode = %lld\n", mapinfo.
pp.
projcode);
104 fprintf(fp,
"mapinfo.pp.zonecode = %lld\n", mapinfo.
pp.
zonecode);
105 fprintf(fp,
"mapinfo.pp.spherecode = %lld\n", mapinfo.
pp.
spherecode);
106 for (i = 0; i < 15 ; i++)
107 fprintf(fp,
"mapinfo.pp.projparam[%d] = %f\n", i, mapinfo.
pp.
projparam[i]);
108 for (i = 0; i < 2 ; i++)
109 fprintf(fp,
"mapinfo.pp.ulc[%d] = %f\n", i, mapinfo.
pp.
ulc[i]);
110 for (i = 0; i < 2 ; i++)
111 fprintf(fp,
"mapinfo.pp.lrc[%d] = %f\n", i, mapinfo.
pp.
lrc[i]);
112 fprintf(fp,
"mapinfo.pp.nblock = %d\n", mapinfo.
pp.
nblock);
113 fprintf(fp,
"mapinfo.pp.nline = %d\n", mapinfo.
pp.
nline);
114 fprintf(fp,
"mapinfo.pp.nsample = %d\n", mapinfo.
pp.
nsample);
115 for (i = 0; i < 179 ; i++)
116 fprintf(fp,
"mapinfo.pp.reloffset[%d] = %f\n", i, mapinfo.
pp.
reloffset[i]);
117 fprintf(fp,
"mapinfo.pp.resolution = %d\n", mapinfo.
pp.
resolution);
HDFFCLIBAPI _fcd _fcd intf intf * datatype
2-dimensional Data Buffer
#define MTK_ERR_MSG_JUMP(msg)
MTKt_status MtkWriteBinFile(const char *filename, MTKt_DataBuffer buf, MTKt_MapInfo mapinfo)
Write binary file.