##// END OF EJS Templates
modification fonction lecture_file_sm()
thomas -
r1:323f9b4b5db0 default
parent child
Show More
@@ -1,25 +1,25
1 1 #include <file_utilities.h>
2 2
3 int lecture_file_sm()
3 int lecture_file_sm(const char * fileName)
4 4 {
5 5 unsigned int i;
6 6
7 7 FILE *infile;
8 infile = fopen("sm_test1.dat", "rb"); // open explicitely a binary file !!! ...
8 infile = fopen(fileName, "rb"); // open explicitely a binary file !!! ...
9 9 if(infile == NULL) {
10 10 printf("Hello I cannot open the file!\n");
11 11 return 0;
12 12 }
13 13 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
14 14 (void) fclose(infile);
15 15 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
16 16 printf("compressed_spectral_matrix_f0 : \n");
17 17 for (i = 0; i < 15; i++) {
18 18 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
19 19 compressed_spectral_matrix_f0[2*i],
20 20 compressed_spectral_matrix_f0[2*i+1]);
21 21 }
22 22
23 23 return 0;
24 24 }
25 25
@@ -1,13 +1,13
1 1 #ifndef FILE_UTILITIES_H
2 2 #define FILE_UTILITIES_H
3 3
4 4 #include <stdio.h>
5 5 #include <basic_parameters_1_ICD_issue1rev6.h>
6 6
7 7 extern float compressed_spectral_matrix_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
8 8 extern unsigned char LFR_BP1_F0[ ];
9 9 extern unsigned char LFR_BP2_F0[ ];
10 10
11 int lecture_file_sm();
11 int lecture_file_sm(const char *fileName);
12 12
13 13 #endif // FILE_UTILITIES_H
@@ -1,40 +1,40
1 1 #include <stdio.h>
2 2 #include <malloc.h>
3 3 #include <basic_parameters_1_ICD_issue1rev6.h>
4 4 #include <file_utilities.h>
5 5
6 6 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
7 7
8 8 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
9 9 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
10 10
11 11 int main(void)
12 12 {
13 13 printf("Hello World!\n");
14 14
15 lecture_file_sm();
15 lecture_file_sm("sm_test1.dat");
16 16
17 17 BP1_set();
18 18
19 19 BP2_set();
20 20
21 21 return 0;
22 22 }
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
@@ -1,16 +1,17
1 1 TEMPLATE = app
2 2 CONFIG += console
3 3 CONFIG -= app_bundle
4 4 CONFIG -= qt
5 5
6 #
6 7 DEFINES += DEBUG_TCH
7 8
8 9 SOURCES += main.c \
9 10 basic_parameters_1_ICD_issue1rev6.c \
10 11 file_utilities.c
11 12
12 13 HEADERS += \
13 14 file_utilities.h \
14 15 basic_parameters_1_ICD_issue1rev6.h
15 16
16 17
General Comments 0
You need to be logged in to leave comments. Login now