C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[55912] TStringList 읽어 오는 것좀 알려주세요
구윤태 [] 1214 읽음    2009-01-28 12:21
[test.txt]

0.000000 -25
0.025000 -26
0.050000 -27
0.075000 -23
0.100000 -26
0.125000 -25
0.150000 -24
0.175000 -25
0.200000 -26
0.225000 -23
0.250000 -24
0.275000 -24
0.300000 -24

...
위의 파일에서  0.xxxxx  -yy
두개의 값이 스페이스 한칸 떨어져 있는데요
이것을 분리해서 아래처럼 차트에 넣으려 합니다.
아래처럼 했는데 잘안되서 혹시 쉬운 방법있으면 알려주세요

FILE *stream;
  TStringList *fList = new TStringList();
  TStringList *fList2 = new TStringList();

  short *d;
  float *f;

   if(this->OpenDialog1->Execute())
   {
       stream = fopen(this->OpenDialog1->FileName.c_str(), "r");
       fList->LoadFromFile(this->OpenDialog1->FileName);
   }

   AnsiString strC;
   /* READ some data to the file */
   while( 0 < fscanf(stream, "%f  %d\n", &f, &d) )
   {
     strC.printf("%f",f);  //여기 부분이 0.000000 값만 출력이 되서 이유를 모르겠습니다.
     fList->Add(strC);

     strC.printf("%d",d);
     fList2->Add(strC);

   }
  fclose(stream);



  for( int i=0; i<fList->Count; i++ )
  {
      strX = fList->Strings[i];
      strY = fList2->Strings[i];

     Chart1->Series[0]->AddXY( StrToFloat(strX),StrToFloat(strY),"",clTeeColor);
}


delete  fList;
delete fList2;

+ -

관련 글 리스트
55912 TStringList 읽어 오는 것좀 알려주세요 구윤태 1214 2009/01/28
55913     Re:TStringList 읽어 오는 것좀 알려주세요 크레브 1483 2009/01/28
55914         고맙습니다. 구윤태 932 2009/01/28
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.