08/11/04 20:07:38
>>184
かなり汚いですが一応動くので載せておきます。
コンマの位置を変えるにはfor文の数字をいじればいいですが、
できればコンマn番目から次のコンマもしくは行末までの文字列を
取り出す関数を別に作ってそれを呼び出した方が綺麗に書けると
思います。
void __fastcall TForm1::Button4Click(TObject *Sender)
{
OpenDialog1->Execute();
std::ifstream ifs(OpenDialog1->FileName.c_str());
std::string str;
if (ifs)
while (std::getline(ifs, str)) {
std::string::size_type pos = 0;
for (int i = 0; i < 5; i++) {
if((pos = str.find(',', pos)) == std::string::npos)
goto next;
pos++;
}
次に続く