Hi. I'm trying to store values read from a file into an array, and then manipulate them as arrays of doubles. I have problems storing the values, as the only I get is the last value read. I would also like to know how to manipulate the char* array to work numerically with its elements.

This is my code...

int count=0;
char buffer[MAX_SAMPLES];
char *array[MAX_SAMPLES];

while(!file1.eof())
{
file1.getline(buffer,20);
array[count]=buffer;
cout<<array[count]<<"\n";
}

for(count=0;count<MAX_SAMPLES;count++)
cout<<array[count]<<"\n"; //here i get just the last value read




I will do this with 4 different files, and then i need to compare the values on each of them to obtain the maximum... the code is:




for(int i=0; i<MAX_SAMPLES; i++)
{
max1 = (array1[i] > array2[i] ?
array1[i]:carray2[i]);

max2 = (array3[i] > array4[i] ?
array3[i]:array4[i]);

max = (max1 > max2 ? max1:max2);

newArray[i] = max;
}

And to make the comparison, the elements have to be numbers!!!


Please help me... I know you can.