BrewSDKで外部テキストを一行ずつ読み込みたい
- 読み込むテキストファイル
t abc ddd ←最終行を作る(改行を入れる)
- ソース
//ファイルを読み込む BrewFileInputStream fis = BrewFileInputStream::Open("test.txt"); //メモリの確保 char* c = new char[fis.GetSize()]; //読み込む fis.Read(c,fis.GetSize()); BrewString str = c; int index = 0; int next = 0; //改行がなくなるまで回して取得する while( -1 != (next = str.IndexOf("\r\n",index)) ){ //トレース Debug::trace(str.Substring(index, next - index)); //+2しているのはBrewStringの改行記号が『\n』ではなく『\r\n』だから index = next + 2; }
日本語はやってないけど読めてないと思う。