|
콤마로 구분된(csv)파일을 스트링그리드에 불러오는 소스를 C빌더로 작성해 보신분 도움을 기다립니다.
아래것은 델파이로 작성한 것 입니다.
cline : string;
Result : string;
thevals : array[0..18] of string;
while not Eof(F) do
begin
ReadLn(F, cline);
GetCsv(cline, thevals);
J:= I + 1;
StringGrid1.RowCount:= J;
Edit1.Text := thevals[1];
StringGrid1.Cells[0, I] := thevals[0];
........................
Function GerCsv(cline:String; Var thevals: array of string): String;
Var
i, p : integer;
Begin
i:=0;
While Pos(',',cine)>0 Do
Begin
p:=Pos(',',cline);
thevals[i]:=Trim( Copy(cline, 1, p-1) );
cline:=Copy(cline, p+1, Length(cline)-p);
Inc(i);
End;
thevals[i]:=cline;
End;
|