PandA-2024.02
examples
cpp_examples
Xilinx_Examples
Math
atan2_cordic
read_file.h
Go to the documentation of this file.
1
#ifndef H_READ_FILE_H
2
#define H_READ_FILE_H
3
4
#include <stdlib.h>
5
#include <stdio.h>
6
7
template
<
int
DIM1,
int
DIM2,
typename
T>
void
read_file
(
char
*
filename
, T outBuf[DIM1][DIM2] )
8
{
9
int
i, j;
10
11
float
data;
12
char
str
[300];
13
14
FILE *fid = fopen( filename,
"r"
);
15
if
(fid==
NULL
)
16
fprintf(
stderr
,
"error in opening input file %s\n"
, filename);
17
18
for
(i = 0; i < DIM1; i++)
19
{
20
for
(j = 0; j < DIM2; j++)
21
{
22
fscanf(fid,
"%s"
, str);
23
data = atof(str);
24
outBuf[i][j] = (T) data;
25
//fprintf(stderr,"%f ", (float) data);
26
}
27
fscanf(fid,
"\n"
);
28
//fprintf(stderr,"\n");
29
}
30
31
fclose(fid);
32
33
return
;
34
}
35
36
37
38
#endif
NULL
#define NULL
Definition:
bsearch-specialized.c:20
flopoco::filename
std::string filename
Definition:
flopoco_wrapper.cpp:143
test_panda.stderr
stderr
Definition:
test_panda.py:922
str
char str[25]
Definition:
fixedptc.c:8
read_file
void read_file(char *filename, T outBuf[DIM1][DIM2])
Definition:
read_file.h:7
Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by
1.8.13