Belle II Software
release-06-02-00
readraw.cc
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#include <stdio.h>
10
#include <stdlib.h>
11
#include <unistd.h>
12
#include <fcntl.h>
13
14
using namespace
std;
15
16
#define MAXBUF 4096000
17
18
int
main
(
int
argc,
char
** argv)
19
{
20
int
fd = open(argv[1], O_RDONLY);
21
if
(fd < 0) {
22
perror(
"fopen"
);
23
exit(-1);
24
}
25
char
* buf =
new
char
[MAXBUF];
26
27
int
nrec = 0;
28
for
(;;) {
29
int
sizebuf;
30
int
sstat = read(fd, &sizebuf,
sizeof
(
int
));
31
if
(sstat <= 0)
break
;
32
int
stat = read(fd, buf, (sizebuf - 1) * 4);
33
if
(stat <= 0)
break
;
34
printf(
"record %d: size = %d\n"
, nrec, sizebuf);
35
nrec++;
36
}
37
38
close(fd);
39
}
40
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:75
daq
rfarm
event
tools
readraw.cc
Generated on Thu Dec 28 2023 02:22:10 for Belle II Software by
1.9.1