Created
February 24, 2012 19:29
-
-
Save iagox86/1903152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
FILE *f = fopen("test.txt", "r"); | |
double array[3][10000]; | |
char line[1024]; | |
char *token; | |
int i, j, k, l; | |
i = 0; | |
while(fgets(line, 1024, f)) | |
{ | |
j = 0; | |
for(token = strtok(line, ","); token != NULL; token = strtok(NULL, ",")) | |
{ | |
array[j++][i] = atof(token); | |
} | |
i++; | |
} | |
for(k = 0; k < i; k++) | |
{ | |
for(l = 0; l < 3; l++) | |
{ | |
printf("%f ", array[l][k]); | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment