Click to See Complete Forum and Search --> : csv


Steen Rabol
April 8th, 1999, 02:17 AM
Hi

What do i need to read a .csv file eg. produced by MS Exel ?

Thanks in advance.
Steen

Karsten Döring
April 8th, 1999, 03:23 AM
This is very simple, a CSV File produced by Excel has columns which are seperated by ;
So just open that file like:

FILE *stream;
char Data[1024];
CString temp;
if( ( stream = fopen( "file.csv", "rt" ) )
{
for( ;; )
{
memset( data, 0, 1024 );
fgets( data, 1024, stream );
if( feof( stream ) ) break;
// if you are here, one line of text is in data
// now produce some code which reads each column of that stream, e.g.: getColumn( ";", data, n, &temp );
}
fclose( stream );
}


good luck !