Reading numbers from a file

Jul 26 2010 5:18 AM
Dear all

I want to read  a file ("test.txt") tha contains the following line and put the numbers in an array

" A  1.3     1.2              2.5       B"

As you can see the spaces between the characters are random

I know that it is extremely is to be done in C with the following way

   float A[3];
   char x1,x2;
   fp1=fopen("test.txt","r");
   fscanf(fp1,"%c %f %f %f %c \n",&x1,&A[0],&A[1],&A[2],&x2);   
   fclose(fp1); 

Can someone tell me how can I do it in C#?

Thanks in advance

Chrysostomos


Answers (1)