19 #include <sys/types.h>
30 #define HIS__BASPERM 0774
32 int f_radware_out1d(
char *pc_file,
char *pc_name,
float *pr_data,
int l_chan,
int l_over)
35 int i32_fd, i32_bytes, i32_hislen;
42 strcat(c_str,pc_file);
45 i32_fd = open(pc_file, O_WRONLY | O_CREAT | O_EXCL,
HIS__BASPERM);
48 printf(
"Error %d opening file %s, already exists?\n",errno, pc_file);
52 strcpy(c_str,pc_name);
61 i32_bytes = write(i32_fd, (
char *) l_head, 4);
62 i32_bytes += write(i32_fd, c_str, 8);
64 i32_bytes += write(i32_fd, (
char *) l_head, 24);
66 i32_bytes += write(i32_fd, (
char *) pr_data, l_chan*4);
68 i32_bytes += write(i32_fd, (
char *) l_head, 4);
70 i32_hislen = l_chan*4 + 40;
71 if (i32_bytes == i32_hislen)
78 printf(
"Error %d. Dumping histogram:%s, %d bytes written to %s\n",
79 errno,pc_name,i32_bytes,pc_file);
81 l_status = close(i32_fd);
84 printf(
"Error %d. Close %s failed!\n",errno,pc_file);
90 int f_radware_out2d(
char *pc_file,
char *pc_name,
int *pl_data,
int l_chan,
int l_over)
92 int i32_fd, i32_bytes, i32_hislen;
99 strcat(c_str,pc_file);
102 i32_fd = open(pc_file, O_WRONLY | O_CREAT | O_EXCL,
HIS__BASPERM);
105 printf(
"Error %d opening file %s, already exists?\n",errno, pc_file);
108 i32_bytes = write(i32_fd, (
char *) pl_data, l_chan*4);
109 if (i32_bytes == l_chan*4)
116 printf(
"Error %d. Dumping histogram:%s, only %d bytes written to %s\n",
117 errno,pc_name,i32_bytes,pc_file);
119 l_status = close(i32_fd);
122 printf(
"Error %d. Close %s failed!\n",errno,pc_file);
int f_radware_out1d(char *pc_file, char *pc_name, float *pr_data, int l_chan, int l_over)
int f_radware_out2d(char *pc_file, char *pc_name, int *pl_data, int l_chan, int l_over)