20 #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)
34 int i32_fd, i32_bytes, i32_hislen;
41 strncat(c_str, pc_file,
sizeof(c_str)-1);
44 i32_fd = open(pc_file, O_WRONLY | O_CREAT | O_EXCL,
HIS__BASPERM);
47 printf(
"Error %d opening file %s, already exists?\n",errno, pc_file);
51 strncpy(c_str,pc_name,
sizeof(c_str));
52 strncat(c_str,
" ",
sizeof(c_str)-1);
60 i32_bytes = write(i32_fd, (
char *) l_head, 4);
61 i32_bytes += write(i32_fd, c_str, 8);
63 i32_bytes += write(i32_fd, (
char *) l_head, 24);
65 i32_bytes += write(i32_fd, (
char *) pr_data, l_chan*4);
67 i32_bytes += write(i32_fd, (
char *) l_head, 4);
69 i32_hislen = l_chan*4 + 40;
70 if (i32_bytes == i32_hislen)
77 printf(
"Error %d. Dumping histogram:%s, %d bytes written to %s\n",
78 errno,pc_name,i32_bytes,pc_file);
80 l_status = close(i32_fd);
83 printf(
"Error %d. Close %s failed!\n",errno,pc_file);
89 int f_radware_out2d(
char *pc_file,
char *pc_name,
int *pl_data,
int l_chan,
int l_over)
91 int i32_fd, i32_bytes;
98 strncat(c_str,pc_file,
sizeof(c_str)-1);
101 i32_fd = open(pc_file, O_WRONLY | O_CREAT | O_EXCL,
HIS__BASPERM);
104 printf(
"Error %d opening file %s, already exists?\n",errno, pc_file);
107 i32_bytes = write(i32_fd, (
char *) pl_data, l_chan*4);
108 if (i32_bytes == l_chan*4)
115 printf(
"Error %d. Dumping histogram:%s, only %d bytes written to %s\n",
116 errno,pc_name,i32_bytes,pc_file);
118 l_status = close(i32_fd);
121 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)