Advertisement
Kyrexar

read file of floats

Aug 4th, 2020
1,529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     float valores[1000];
  6.     int i = 0;
  7.     FILE *f;
  8.  
  9.     f = open("datos.txt", "r");
  10.     while (f != EOF)
  11.     {
  12.         fscanf(f, "%f", &valores[i]);
  13.         i++;
  14.     }
  15.     fclose(f);
  16.  
  17.     // aqui lo que quieras procesar del array
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement