##// END OF EJS Templates
modification fonction lecture_file_sm()
thomas -
r1:323f9b4b5db0 default
parent child
Show More
@@ -1,25 +1,25
1 #include <file_utilities.h>
1 #include <file_utilities.h>
2
2
3 int lecture_file_sm()
3 int lecture_file_sm(const char * fileName)
4 {
4 {
5 unsigned int i;
5 unsigned int i;
6
6
7 FILE *infile;
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 if(infile == NULL) {
9 if(infile == NULL) {
10 printf("Hello I cannot open the file!\n");
10 printf("Hello I cannot open the file!\n");
11 return 0;
11 return 0;
12 }
12 }
13 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
13 (void) fread(compressed_spectral_matrix_f0, sizeof(compressed_spectral_matrix_f0), 1, infile);
14 (void) fclose(infile);
14 (void) fclose(infile);
15 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
15 //printf("size of compressed_spectral_matrix_f0 : %d\n", sizeof(compressed_spectral_matrix_f0));
16 printf("compressed_spectral_matrix_f0 : \n");
16 printf("compressed_spectral_matrix_f0 : \n");
17 for (i = 0; i < 15; i++) {
17 for (i = 0; i < 15; i++) {
18 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
18 printf("Element number %.2d (%.2d & %.2d) => Re:%16.8e Im:%16.8e\n", i+1, 2*i, 2*i+1,
19 compressed_spectral_matrix_f0[2*i],
19 compressed_spectral_matrix_f0[2*i],
20 compressed_spectral_matrix_f0[2*i+1]);
20 compressed_spectral_matrix_f0[2*i+1]);
21 }
21 }
22
22
23 return 0;
23 return 0;
24 }
24 }
25
25
@@ -1,13 +1,13
1 #ifndef FILE_UTILITIES_H
1 #ifndef FILE_UTILITIES_H
2 #define FILE_UTILITIES_H
2 #define FILE_UTILITIES_H
3
3
4 #include <stdio.h>
4 #include <stdio.h>
5 #include <basic_parameters_1_ICD_issue1rev6.h>
5 #include <basic_parameters_1_ICD_issue1rev6.h>
6
6
7 extern float compressed_spectral_matrix_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
7 extern float compressed_spectral_matrix_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
8 extern unsigned char LFR_BP1_F0[ ];
8 extern unsigned char LFR_BP1_F0[ ];
9 extern unsigned char LFR_BP2_F0[ ];
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 #endif // FILE_UTILITIES_H
13 #endif // FILE_UTILITIES_H
@@ -1,40 +1,40
1 #include <stdio.h>
1 #include <stdio.h>
2 #include <malloc.h>
2 #include <malloc.h>
3 #include <basic_parameters_1_ICD_issue1rev6.h>
3 #include <basic_parameters_1_ICD_issue1rev6.h>
4 #include <file_utilities.h>
4 #include <file_utilities.h>
5
5
6 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
6 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
7
7
8 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
8 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
9 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
9 unsigned char LFR_BP2_F0[NB_BINS_COMPRESSED_MATRIX_f0*30];
10
10
11 int main(void)
11 int main(void)
12 {
12 {
13 printf("Hello World!\n");
13 printf("Hello World!\n");
14
14
15 lecture_file_sm();
15 lecture_file_sm("sm_test1.dat");
16
16
17 BP1_set();
17 BP1_set();
18
18
19 BP2_set();
19 BP2_set();
20
20
21 return 0;
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 TEMPLATE = app
1 TEMPLATE = app
2 CONFIG += console
2 CONFIG += console
3 CONFIG -= app_bundle
3 CONFIG -= app_bundle
4 CONFIG -= qt
4 CONFIG -= qt
5
5
6 #
6 DEFINES += DEBUG_TCH
7 DEFINES += DEBUG_TCH
7
8
8 SOURCES += main.c \
9 SOURCES += main.c \
9 basic_parameters_1_ICD_issue1rev6.c \
10 basic_parameters_1_ICD_issue1rev6.c \
10 file_utilities.c
11 file_utilities.c
11
12
12 HEADERS += \
13 HEADERS += \
13 file_utilities.h \
14 file_utilities.h \
14 basic_parameters_1_ICD_issue1rev6.h
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