1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
float * NyquistfilterDVBTSignauxtests()
{
/*------déclaration et initialisation des variables------*/
int i;
FILE *FicEntree;
float *coeff_filtre;
char *temp;
long taille_fichier;
double tempo;
FicEntree = fopen("C:/Documents and Settings/garnier/Mes documents/doc/test.txt", "r");
if (FicEntree == NULL) printf("Problème d'ouverture");
/*On fait pointer FicEntree vers la fin du fichier */
fseek(FicEntree,SEEK_END,0);
/*On met la taille du fichier dans taille_fichier (car FicEntree pointe vers la fin du fichier,
sa position donne le nombre d'octets pour arriver à la fin) */
taille_fichier=ftell(FicEntree);
/*On refait pointer FicEntree au début du fichier*/
fseek(FicEntree,SEEK_SET,0);
/*Allocation de temp avec la taille du fichier*/
temp=(char *)malloc(sizeof(char) * taille_fichier);
coeff_filtre=(float *)malloc(sizeof(float) * taille_fichier);
/*
fscanf(FicEntree, "%s", temp);
printf("voila ce qu'il y a dans temp: %s\n", temp);
*/
fgets(temp,10,FicEntree);
tempo=strtod(temp,&temp);
printf("ligne: %lf\n", tempo);
fclose(FicEntree);
/*On libère temp*/
free(temp);
/* for(i=0; i<taille_fichier;i++)
{
coeff_filtre[i]=temp;
printf("%f ",coeff_filtre[i]);
}
*/
return(coeff_filtre);
} |
Partager