Reading a .csv file
-
Hi, How can I read raws and columns of a .csv file? I would like to move from one column to the next,, how can I do that ? Ehsan Behboudi
The raws (rows) of the file can easily be read with
CStdioFile::ReadString()
. The columns can be handled withAfxExtractSubstring()
, orCString::Find()
. There's more than one way to skin a cat, however.
A rich person is not the one who has the most, but the one that needs the least.
-
The raws (rows) of the file can easily be read with
CStdioFile::ReadString()
. The columns can be handled withAfxExtractSubstring()
, orCString::Find()
. There's more than one way to skin a cat, however.
A rich person is not the one who has the most, but the one that needs the least.
-
how do I use those commands in my code right now this is how I read my .csv file ifstream infile(file1); char temp[500]; infile>>temp; // so now i want to move to the next row or column, how do I do that with your syntax? Thanks Ehsan Behboudi
Very seldom do I use streams so this might not work, although it should get you close:
istream in;
while (in.eof() == 0)
{
is.getline(temp, sizeof(temp));
// now do something with the line just read
}
A rich person is not the one who has the most, but the one that needs the least.