king1980
27th January 2010, 12:16
Hi ,
I am trying to read a csv file using following code,but when i am displaying the data using messge it's dispalying first char for first column and second column it's displaying data properly.
function readfile()
{
#define SCANS "%s,%s"
#define FIELDS a,b
long fp
string FIELDS(50)
string buffer(80)
fp = seq.open("/tmp/fl.csv", "r")
while not seq.gets(buffer,1024,fp)
string.scan(buffer,SCANS,FIELDS)
message("%s,%s",FIELDS)
endwhile
e = seq.close(fp)
}
e.g
ABC,XYZ
so it's printing A,XYZ
Regards
King1980
I am trying to read a csv file using following code,but when i am displaying the data using messge it's dispalying first char for first column and second column it's displaying data properly.
function readfile()
{
#define SCANS "%s,%s"
#define FIELDS a,b
long fp
string FIELDS(50)
string buffer(80)
fp = seq.open("/tmp/fl.csv", "r")
while not seq.gets(buffer,1024,fp)
string.scan(buffer,SCANS,FIELDS)
message("%s,%s",FIELDS)
endwhile
e = seq.close(fp)
}
e.g
ABC,XYZ
so it's printing A,XYZ
Regards
King1980