I am having a problem in reading CSV file using Delphi 5.
File contents are
1. a,b,c,d //1st line
2. ,,,,e,f //2nd line
3. n,d,e,f //3rd line
4. a,c,e //4th line
I am using following code to read
var
respCSV : TStringList ;
sLine : string ;
tf : TextFile;
begin
respCSV := TStringList.Create ;
// prompt the user for a file-name then load into a string list
with openDialog1 do
begin
FileName := '';
if Execute then
begin
AssignFile(tf, FileName);
Reset(tf);
while not eof(tf) do
begin
sLine := '' ;
ReadLn(tf,sLine); //In Debug/Evaluate it shows 2nd row perfectly
showMessage(sLine); //but in showMessage Here 2nd row is showing as
//null, While it has nulls only in start
respCSV.Add(sLine); //Adding 2nd row as empty row
end; //end while
end;//end if
end;//end with
2nd row in File starts with Null ,,,,e,f.. so it is showing all line as null