@ melissad - What you poseted was not c call at all. fstream is from the C++ STL. Not sure if you noticed but your code will run forever or throw an exception for reading outside the bounds of the file or array. There is an error with the inner for loop.
ok Hiroshe actually my file is of numeric type.And there are almost seventeen to eighteen columns but i want to read only first two columns and find the mean of second column. You can see from the file i attached.
Well that is pretty easy to do. You need to calls two >> and one call to ignore to eat the rest of the line. The folwwing is psuedo code:
// use ifstream for file read operations
ifstream file(some data file);
// since the first read operation in a line is >> use that for the loop control
while (file >> column1)
file >> column2
file ignore rest of line
add column1 and column2 to some sort of container.
You can read here on how to ignore the rest of the line in the file.